improvement: updated translations en/pt

This commit is contained in:
canove
2020-09-28 15:41:19 -03:00
parent 3c0ecd8fb1
commit c4aa05ea4a
13 changed files with 325 additions and 72 deletions

View File

@@ -27,6 +27,7 @@ import api from "../../services/api";
import WhatsAppModal from "../../components/WhatsAppModal";
import ConfirmationModal from "../../components/ConfirmationModal";
import QrcodeModal from "../../components/QrcodeModal";
import { i18n } from "../../translate/i18n";
const reducer = (state, action) => {
if (action.type === "LOAD_WHATSAPPS") {
@@ -179,7 +180,7 @@ const Connections = () => {
const handleDeleteWhatsApp = async whatsAppId => {
try {
await api.delete(`/whatsapp/${whatsAppId}`);
toast.success("Deleted!");
toast.success(i18n.t("connections.toasts.deleted"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {
@@ -192,12 +193,17 @@ const Connections = () => {
return (
<MainContainer>
<ConfirmationModal
title={deletingWhatsApp && `Delete ${deletingWhatsApp.name}?`}
title={
deletingWhatsApp &&
`${i18n.t("connections.confirmationModal.deleteTitle")} ${
deletingWhatsApp.name
}?`
}
open={confirmModalOpen}
setOpen={setConfirmModalOpen}
onConfirm={() => handleDeleteWhatsApp(deletingWhatsApp.id)}
>
Are you sure? It cannot be reverted.
{i18n.t("connections.confirmationModal.deleteMessage")}
</ConfirmationModal>
<QrcodeModal
open={qrModalOpen}
@@ -212,14 +218,14 @@ const Connections = () => {
whatsAppId={selectedWhatsApp && !qrModalOpen && selectedWhatsApp.id}
/>
<MainHeader>
<Title>Connections</Title>
<Title>{i18n.t("connections.title")}</Title>
<MainHeaderButtonsWrapper>
<Button
variant="contained"
color="primary"
onClick={handleOpenWhatsAppModal}
>
Add Whatsapp
{i18n.t("connections.buttons.add")}
</Button>
</MainHeaderButtonsWrapper>
</MainHeader>
@@ -227,11 +233,21 @@ const Connections = () => {
<Table size="small">
<TableHead>
<TableRow>
<TableCell align="center">Name</TableCell>
<TableCell align="center">Status</TableCell>
<TableCell align="center">Last update</TableCell>
<TableCell align="center">Default</TableCell>
<TableCell align="center">Actions</TableCell>
<TableCell align="center">
{i18n.t("connections.table.name")}
</TableCell>
<TableCell align="center">
{i18n.t("connections.table.status")}
</TableCell>
<TableCell align="center">
{i18n.t("connections.table.lastUpdate")}
</TableCell>
<TableCell align="center">
{i18n.t("connections.table.default")}
</TableCell>
<TableCell align="center">
{i18n.t("connections.table.actions")}
</TableCell>
</TableRow>
</TableHead>
<TableBody>

View File

@@ -164,7 +164,7 @@ const Contacts = () => {
const handleDeleteContact = async contactId => {
try {
await api.delete(`/contacts/${contactId}`);
toast.success("Contact deleted sucessfully!");
toast.success(i18n.t("contacts.toasts.deleted"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {

View File

@@ -9,6 +9,7 @@ import Select from "@material-ui/core/Select";
import { toast } from "react-toastify";
import api from "../../services/api";
import { i18n } from "../../translate/i18n.js";
const useStyles = makeStyles(theme => ({
root: {
@@ -78,7 +79,7 @@ const Settings = () => {
await api.put(`/settings/${settingKey}`, {
value: selectedValue,
});
toast.success("Setting updated");
toast.success(i18n.t("settings.success"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {
@@ -96,10 +97,12 @@ const Settings = () => {
<div className={classes.root}>
<Container className={classes.container} maxWidth="sm">
<Typography variant="body2" gutterBottom>
Settings
{i18n.t("settings.title")}
</Typography>
<Paper className={classes.paper}>
<Typography variant="body1">User creation</Typography>
<Typography variant="body1">
{i18n.t("settings.settings.userCreation.name")}
</Typography>
<Select
margin="dense"
variant="outlined"
@@ -112,8 +115,12 @@ const Settings = () => {
className={classes.settingOption}
onChange={handleChangeSetting}
>
<option value="enabled">Enabled</option>
<option value="disabled">Disabled</option>
<option value="enabled">
{i18n.t("settings.settings.userCreation.options.enabled")}
</option>
<option value="disabled">
{i18n.t("settings.settings.userCreation.options.disabled")}
</option>
</Select>
</Paper>
</Container>

View File

@@ -24,6 +24,7 @@ import MainHeaderButtonsWrapper from "../../components/MainHeaderButtonsWrapper"
import Title from "../../components/Title";
import api from "../../services/api";
import { i18n } from "../../translate/i18n";
import TableRowSkeleton from "../../components/TableRowSkeleton";
import UserModal from "../../components/UserModal";
import ConfirmationModal from "../../components/ConfirmationModal";
@@ -161,7 +162,7 @@ const Users = () => {
const handleDeleteUser = async userId => {
try {
await api.delete(`/users/${userId}`);
toast.success("User deleted!");
toast.success(i18n.t("users.toasts.deleted"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {
@@ -188,12 +189,17 @@ const Users = () => {
return (
<MainContainer>
<ConfirmationModal
title={deletingUser && `Delete ${deletingUser.name}?`}
title={
deletingUser &&
`${i18n.t("users.confirmationModal.deleteTitle")} ${
deletingUser.name
}?`
}
open={confirmModalOpen}
setOpen={setConfirmModalOpen}
onConfirm={e => handleDeleteUser(deletingUser.id)}
onConfirm={() => handleDeleteUser(deletingUser.id)}
>
Are you sure? It canoot be reverted.
{i18n.t("users.confirmationModal.deleteMessage")}
</ConfirmationModal>
<UserModal
open={userModalOpen}
@@ -202,10 +208,10 @@ const Users = () => {
userId={selectedUser && selectedUser.id}
/>
<MainHeader>
<Title>Usuários</Title>
<Title>{i18n.t("users.title")}</Title>
<MainHeaderButtonsWrapper>
<TextField
placeholder="Search..."
placeholder={i18n.t("contacts.searchPlaceholder")}
type="search"
value={searchParam}
onChange={handleSearch}
@@ -222,7 +228,7 @@ const Users = () => {
color="primary"
onClick={handleOpenUserModal}
>
Novo Usuário
{i18n.t("users.buttons.add")}
</Button>
</MainHeaderButtonsWrapper>
</MainHeader>
@@ -234,10 +240,12 @@ const Users = () => {
<Table size="small">
<TableHead>
<TableRow>
<TableCell>Name</TableCell>
<TableCell>Email</TableCell>
<TableCell>Profile</TableCell>
<TableCell align="right">Actions</TableCell>
<TableCell>{i18n.t("users.table.name")}</TableCell>
<TableCell>{i18n.t("users.table.email")}</TableCell>
<TableCell>{i18n.t("users.table.profile")}</TableCell>
<TableCell align="right">
{i18n.t("users.table.actions")}
</TableCell>
</TableRow>
</TableHead>
<TableBody>