Skip to content

Commit

Permalink
Internationalization of some messages
Browse files Browse the repository at this point in the history
Contributed by @gsuee
  • Loading branch information
gsuee authored Sep 2, 2024
1 parent 234b6bb commit 809f9e4
Show file tree
Hide file tree
Showing 7 changed files with 351 additions and 32 deletions.
47 changes: 24 additions & 23 deletions frontend/src/components/Settings/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { faCopy, faGears } from '@fortawesome/free-solid-svg-icons';

import { generateSecureToken } from "../../helpers/generateSecureToken";
import { copyToClipboard } from "../../helpers/copyToClipboard";
import { i18n } from "../../translate/i18n.js";

const useStyles = makeStyles((theme) => ({
container: {
Expand Down Expand Up @@ -319,16 +320,16 @@ export default function Options(props) {
</Grid> */}
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="ratings-label">Avaliações</InputLabel>
<InputLabel id="ratings-label">{i18n.t("settings.validations.title")}</InputLabel>
<Select
labelId="ratings-label"
value={userRating}
onChange={async (e) => {
handleChangeUserRating(e.target.value);
}}
>
<MenuItem value={"disabled"}>Desabilitadas</MenuItem>
<MenuItem value={"enabled"}>Habilitadas</MenuItem>
<MenuItem value={"disabled"}>{i18n.t("settings.validations.options.disabled")}</MenuItem>
<MenuItem value={"enabled"}>{i18n.t("settings.validations.options.enabled")}</MenuItem>
</Select>
<FormHelperText>
{loadingUserRating && "Atualizando..."}
Expand All @@ -338,7 +339,7 @@ export default function Options(props) {
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="schedule-type-label">
Gerenciamento de Expediente
{i18n.t("settings.OfficeManagement.title")}
</InputLabel>
<Select
labelId="schedule-type-label"
Expand All @@ -347,9 +348,9 @@ export default function Options(props) {
handleScheduleType(e.target.value);
}}
>
<MenuItem value={"disabled"}>Desabilitado</MenuItem>
<MenuItem value={"queue"}>Gerenciamento Por Fila</MenuItem>
<MenuItem value={"company"}>Gerenciamento Por Empresa</MenuItem>
<MenuItem value={"disabled"}>{i18n.t("settings.OfficeManagement.options.disabled")}</MenuItem>
<MenuItem value={"queue"}>{i18n.t("settings.OfficeManagement.options.ManagementByDepartment")}</MenuItem>
<MenuItem value={"company"}>{i18n.t("settings.OfficeManagement.options.ManagementByCompany")}</MenuItem>
</Select>
<FormHelperText>
{loadingScheduleType && "Atualizando..."}
Expand All @@ -359,7 +360,7 @@ export default function Options(props) {
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="group-type-label">
Ignorar Mensagens de Grupos
{i18n.t("settings.IgnoreGroupMessages.title")}
</InputLabel>
<Select
labelId="group-type-label"
Expand All @@ -368,8 +369,8 @@ export default function Options(props) {
handleGroupType(e.target.value);
}}
>
<MenuItem value={"disabled"}>Desativado</MenuItem>
<MenuItem value={"enabled"}>Ativado</MenuItem>
<MenuItem value={"disabled"}>{i18n.t("settings.IgnoreGroupMessages.options.disabled")}</MenuItem>
<MenuItem value={"enabled"}>{i18n.t("settings.IgnoreGroupMessages.options.enabled")}</MenuItem>
</Select>
<FormHelperText>
{loadingScheduleType && "Atualizando..."}
Expand All @@ -379,7 +380,7 @@ export default function Options(props) {
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="call-type-label">
Chamadas de Voz e Vídeo
{i18n.t("settings.VoiceAndVideoCalls.title")}
</InputLabel>
<Select
labelId="call-type-label"
Expand All @@ -388,8 +389,8 @@ export default function Options(props) {
handleCallType(e.target.value);
}}
>
<MenuItem value={"disabled"}>Informar indisponibilidade</MenuItem>
<MenuItem value={"enabled"}>Ignorar</MenuItem>
<MenuItem value={"disabled"}>{i18n.t("settings.VoiceAndVideoCalls.options.disabled")}</MenuItem>
<MenuItem value={"enabled"}>{i18n.t("settings.VoiceAndVideoCalls.options.enabled")}</MenuItem>
</Select>
<FormHelperText>
{loadingCallType && "Atualizando..."}
Expand Down Expand Up @@ -418,7 +419,7 @@ export default function Options(props) {
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="group-type-label">
Saída automática de chatbot
{i18n.t("settings.AutomaticChatbotOutput.title")}
</InputLabel>
<Select
labelId="chatbot-autoexit"
Expand All @@ -427,8 +428,8 @@ export default function Options(props) {
handleChatbotAutoExit(e.target.value);
}}
>
<MenuItem value={"disabled"}>Desativado</MenuItem>
<MenuItem value={"enabled"}>Ativado</MenuItem>
<MenuItem value={"disabled"}>{i18n.t("settings.AutomaticChatbotOutput.options.disabled")}</MenuItem>
<MenuItem value={"enabled"}>{i18n.t("settings.AutomaticChatbotOutput.options.enabled")}</MenuItem>
</Select>
<FormHelperText>
{loadingChatbotAutoExit && "Atualizando..."}
Expand All @@ -438,7 +439,7 @@ export default function Options(props) {
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="quickmessages-label">
Mensagens Rápidas
{i18n.t("settings.QuickMessages.title")}
</InputLabel>
<Select
labelId="quickmessages-label"
Expand All @@ -447,8 +448,8 @@ export default function Options(props) {
handleQuickMessages(e.target.value);
}}
>
<MenuItem value={"company"}>Por empresa</MenuItem>
<MenuItem value={"individual"}>Por usuário</MenuItem>
<MenuItem value={"company"}>{i18n.t("settings.QuickMessages.options.enabled")}</MenuItem>
<MenuItem value={"individual"}>{i18n.t("settings.QuickMessages.options.disabled")}</MenuItem>
</Select>
<FormHelperText>
{loadingQuickMessages && "Atualizando..."}
Expand Down Expand Up @@ -517,7 +518,7 @@ export default function Options(props) {
<Grid xs={12} sm={6} md={4} item>
<FormControl className={classes.selectContainer}>
<InputLabel id="group-type-label">
Permitir cadastro
{i18n.t("settings.AllowRegistration.title")}
</InputLabel>
<Select
labelId="allow-signup"
Expand All @@ -526,8 +527,8 @@ export default function Options(props) {
handleAllowSignup(e.target.value);
}}
>
<MenuItem value={"disabled"}>Desativado</MenuItem>
<MenuItem value={"enabled"}>Ativado</MenuItem>
<MenuItem value={"disabled"}>{i18n.t("settings.AllowRegistration.options.disabled")}</MenuItem>
<MenuItem value={"enabled"}>{i18n.t("settings.AllowRegistration.options.enabled")}</MenuItem>
</Select>
<FormHelperText>
{loadingAllowSignup && "Atualizando..."}
Expand All @@ -540,7 +541,7 @@ export default function Options(props) {
<FormControl className={classes.selectContainer}>
<TextField
id="appname-field"
label="Limite de Download de arquivos (MB)"
label={i18n.t("settings.FileDownloadLimit.title")}
variant="standard"
name="appName"
value={downloadLimit}
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import NestedMenuItem from "material-ui-nested-menu-item";
import GoogleAnalytics from "../components/GoogleAnalytics";
import OnlyForSuperUser from "../components/OnlyForSuperUser";



const drawerWidth = 240;

const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -413,11 +415,11 @@ const LoggedInLayout = ({ children, themeToggle }) => {
>
{greaterThenSm && user?.profile === "admin" && user?.company?.dueDate ? (
<>
Olá <b>{user.name}</b>, seja bem-vindo a <b>{user?.company?.name}</b>! (Ativo até {dateToClient(user?.company?.dueDate)})
{i18n.t("settings.WelcomeGreeting.greetings")} <b>{user.name}</b>, {i18n.t("settings.WelcomeGreeting.welcome")} <b>{user?.company?.name}</b>! ({i18n.t("settings.WelcomeGreeting.expirationTime")} {dateToClient(user?.company?.dueDate)})
</>
) : (
<>
Olá <b>{user.name}</b>, seja bem-vindo a <b>{user?.company?.name}</b>!
{i18n.t("settings.WelcomeGreeting.greetings")} <b>{user.name}</b>, {i18n.t("settings.WelcomeGreeting.welcome")} <b>{user?.company?.name}</b>! ({i18n.t("settings.WelcomeGreeting.expirationTime")} {dateToClient(user?.company?.dueDate)})
</>
)}
</Typography>
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/pages/SettingsCustom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ const SettingsCustom = () => {
onChange={handleTabChange}
className={classes.tab}
>
<Tab label="Opções" value={"options"} />
{schedulesEnabled && <Tab label="Horários" value={"schedules"} />}
{isSuper() ? <Tab label="Empresas" value={"companies"} /> : null}
{isSuper() ? <Tab label="Planos" value={"plans"} /> : null}
{isSuper() ? <Tab label="Ajuda" value={"helps"} /> : null}
{isSuper() ? <Tab label="Whitelabel" value={"whitelabel"} /> : null}
{isSuper() ? <Tab label="Pay Gateways" value={"paymentGateway"} /> : null}
<Tab label={i18n.t("settings.Options.title")} value={"options"} />
{schedulesEnabled && <Tab label={i18n.t("settings.schedules.title")} value={"schedules"} />}
{isSuper() ? <Tab label={i18n.t("settings.Companies.title")} value={"companies"} /> : null}
{isSuper() ? <Tab label={i18n.t("settings.Plans.title")} value={"plans"} /> : null}
{isSuper() ? <Tab label={i18n.t("settings.Help.title")} value={"helps"} /> : null}
{isSuper() ? <Tab label={i18n.t("settings.Whitelabel.title")} value={"whitelabel"} /> : null}
{isSuper() ? <Tab label={i18n.t("settings.PaymentGateways.title")} value={"paymentGateway"} /> : null}
</Tabs>
<Paper className={classes.paper} elevation={0}>
<TabPanel
Expand Down
79 changes: 79 additions & 0 deletions frontend/src/translate/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,85 @@ const messages = {
},
},
},
validations: {
title:"validations",
options: {
enabled: "enabled",
disabled: "disabled",
},
},
OfficeManagement: {
title:"Office Management",
options: {
disabled: "disabled",
ManagementByDepartment: "Management By Department",
ManagementByCompany: "Management By Company",
},
},
IgnoreGroupMessages: {
title:"Ignore Group Messages",
options: {
enabled: "enabled",
disabled: "disabled",
},
},
VoiceAndVideoCalls: {
title:"Voice and video calls",
options: {
enabled: "Ignore",
disabled: "unavailability report",
},
},
AutomaticChatbotOutput: {
title:"Automatic Chatbot Output",
options: {
enabled: "enabled",
disabled: "disabled",
},
},
QuickMessages: {
title:"Quick Messages",
options: {
enabled: "By company",
disabled: "By User",
},
},
AllowRegistration: {
title:"Allow Registration",
options: {
enabled: "enabled",
disabled: "disabled",
},
},
FileDownloadLimit: {
title:"File Download Limit (MB)",
},
WelcomeGreeting: {
greetings: "Hello",
welcome: "Welcome to",
expirationTime: "Active until",
},
Options: {
title:"Options",
},
Companies: {
title:"Companies",
},
schedules: {
title:"schedules",
},
Plans: {
title:"Plans",
},
Help: {
title:"Help",
},
Whitelabel: {
title:"Whitelabel",
},
PaymentGateways: {
title:"Pasarelas de pago",
},
},
messagesList: {
header: {
Expand Down
79 changes: 79 additions & 0 deletions frontend/src/translate/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,85 @@ const messages = {
},
},
},
validations: {
title:"Validaciones",
options: {
enabled: "Habilitado",
disabled: "Deshabilitado",
},
},
OfficeManagement: {
title:"Gestión de despachos",
options: {
disabled: "Deshabilitado",
ManagementByDepartment: "Gestión por departamento",
ManagementByCompany: "Gestión por empresa",
},
},
IgnoreGroupMessages: {
title:"Ignorar mensajes de grupo",
options: {
enabled: "Activado",
disabled: "Desactivado",
},
},
VoiceAndVideoCalls: {
title:"Llamadas de voz y vídeo",
options: {
enabled: "Ignorar",
disabled: "informe de indisponibilidad",
},
},
AutomaticChatbotOutput: {
title:"Salida automática del chatbot",
options: {
enabled: "Activado",
disabled: "Desactivado",
},
},
QuickMessages: {
title:"Respuestas rápidas",
options: {
enabled: "Por empresa",
disabled: "Por Usuario",
},
},
AllowRegistration: {
title:"Permitir el registro",
options: {
enabled: "Activado",
disabled: "Desactivado",
},
},
FileDownloadLimit: {
title:"Límite de descarga de archivos (MB)",
},
WelcomeGreeting: {
greetings: "hola",
welcome: "bienvenido a",
expirationTime: "Activo hasta",
},
Options: {
title:"Opciones",
},
Companies: {
title:"Empresas",
},
schedules: {
title:"horarios",
},
Plans: {
title:"Planes",
},
Help: {
title:"Ayuda",
},
Whitelabel: {
title:"Whitelabel",
},
PaymentGateways: {
title:"Payment gateways",
},
},
messagesList: {
header: {
Expand Down
Loading

0 comments on commit 809f9e4

Please sign in to comment.