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

@@ -103,7 +103,7 @@ const ContactModal = ({ open, onClose, contactId }) => {
} else {
await api.post("/contacts", values);
}
toast.success("Contact saved sucessfully!");
toast.success(i18n.t("contactModal.success"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {

View File

@@ -5,7 +5,7 @@ import { toast } from "react-toastify";
import MenuItem from "@material-ui/core/MenuItem";
import Menu from "@material-ui/core/Menu";
// import { i18n } from "../../translate/i18n";
import { i18n } from "../../translate/i18n";
import api from "../../services/api";
import ConfirmationModal from "../ConfirmationModal";
@@ -31,12 +31,12 @@ const MessageOptionsMenu = ({ messageId, menuOpen, handleClose, anchorEl }) => {
return (
<>
<ConfirmationModal
title={`Delete message?`}
title={i18n.t("messageOptionsMenu.confirmationModal.title")}
open={confirmationOpen}
setOpen={setConfirmationOpen}
onConfirm={handleDeleteMessage}
>
This action cannot be reverted.
{i18n.t("messageOptionsMenu.confirmationModal.message")}
</ConfirmationModal>
<Menu
anchorEl={anchorEl}
@@ -53,9 +53,9 @@ const MessageOptionsMenu = ({ messageId, menuOpen, handleClose, anchorEl }) => {
onClose={handleClose}
>
<MenuItem onClick={handleOpenConfirmationModal}>
Delete Message
{i18n.t("messageOptionsMenu.delete")}
</MenuItem>
<MenuItem disabled>Reply Message</MenuItem>
<MenuItem disabled> {i18n.t("messageOptionsMenu.reply")}</MenuItem>
</Menu>
</>
);

View File

@@ -183,7 +183,7 @@ const NotificationsPopOver = () => {
<List dense className={classes.tabContainer}>
{notifications.length === 0 ? (
<ListItem>
<ListItemText>No tickets with unread messages.</ListItemText>
<ListItemText>{i18n.t("notifications.noTickets")}</ListItemText>
</ListItem>
) : (
notifications.map(ticket => (

View File

@@ -18,7 +18,7 @@ import InputLabel from "@material-ui/core/InputLabel";
import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl";
// import { i18n } from "../../translate/i18n";
import { i18n } from "../../translate/i18n";
import api from "../../services/api";
@@ -105,7 +105,7 @@ const UserModal = ({ open, onClose, userId }) => {
} else {
await api.post("/users", values);
}
toast.success("Success!");
toast.success(i18n.t("userModal.success"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {
@@ -119,7 +119,9 @@ const UserModal = ({ open, onClose, userId }) => {
<div className={classes.root}>
<Dialog open={open} onClose={handleClose} maxWidth="lg" scroll="paper">
<DialogTitle id="form-dialog-title">
{userId ? `Edit User` : `New User`}
{userId
? `${i18n.t("userModal.title.edit")}`
: `${i18n.t("userModal.title.add")}`}
</DialogTitle>
<Formik
initialValues={user}
@@ -137,7 +139,7 @@ const UserModal = ({ open, onClose, userId }) => {
<DialogContent dividers>
<Field
as={TextField}
label="Name"
label={i18n.t("userModal.form.name")}
autoFocus
name="name"
error={touched.name && Boolean(errors.name)}
@@ -148,7 +150,7 @@ const UserModal = ({ open, onClose, userId }) => {
/>
<Field
as={TextField}
label="Email"
label={i18n.t("userModal.form.email")}
name="email"
error={touched.email && Boolean(errors.email)}
helperText={touched.email && errors.email}
@@ -158,7 +160,7 @@ const UserModal = ({ open, onClose, userId }) => {
<div>
<Field
as={TextField}
label="New Password"
label={i18n.t("userModal.form.password")}
type="password"
name="password"
error={touched.password && Boolean(errors.password)}
@@ -176,7 +178,7 @@ const UserModal = ({ open, onClose, userId }) => {
</InputLabel>
<Field
as={Select}
label="Profile"
label={i18n.t("userModal.form.profile")}
name="profile"
labelId="profile-selection-label"
id="profile-selection"
@@ -195,7 +197,7 @@ const UserModal = ({ open, onClose, userId }) => {
disabled={isSubmitting}
variant="outlined"
>
Cancel
{i18n.t("userModal.buttons.cancel")}
</Button>
<Button
type="submit"
@@ -204,7 +206,9 @@ const UserModal = ({ open, onClose, userId }) => {
variant="contained"
className={classes.btnWrapper}
>
{"Ok"}
{userId
? `${i18n.t("userModal.buttons.okEdit")}`
: `${i18n.t("userModal.buttons.okAdd")}`}
{isSubmitting && (
<CircularProgress
size={24}

View File

@@ -20,6 +20,7 @@ import {
// import { i18n } from "../../translate/i18n";
import api from "../../services/api";
import { i18n } from "../../translate/i18n";
const useStyles = makeStyles(theme => ({
form: {
@@ -91,7 +92,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
} else {
await api.post("/whatsapp", values);
}
toast.success("Success!");
toast.success(i18n.t("whatsappModal.success"));
} catch (err) {
console.log(err);
if (err.response && err.response.data && err.response.data.error) {
@@ -108,7 +109,11 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
return (
<Dialog open={open} onClose={handleClose} maxWidth="lg" scroll="paper">
<DialogTitle>WhatsApp</DialogTitle>
<DialogTitle>
{whatsAppId
? i18n.t("whatsappModal.title.edit")
: i18n.t("whatsappModal.title.add")}
</DialogTitle>
<Formik
initialValues={whatsApp}
enableReinitialize={true}
@@ -116,7 +121,6 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
onSubmit={(values, actions) => {
setTimeout(() => {
handleSaveWhatsApp(values);
// alert(JSON.stringify(values, null, 2));
actions.setSubmitting(false);
}, 400);
}}
@@ -126,7 +130,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
<DialogContent dividers className={classes.form}>
<Field
as={TextField}
label="Name"
label={i18n.t("whatsappModal.form.name")}
autoFocus
name="name"
error={touched.name && Boolean(errors.name)}
@@ -144,7 +148,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
checked={values.isDefault}
/>
}
label="Default"
label={i18n.t("whatsappModal.form.default")}
/>
</DialogContent>
<DialogActions>
@@ -154,7 +158,7 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
disabled={isSubmitting}
variant="outlined"
>
Cancel
{i18n.t("whatsappModal.buttons.cancel")}
</Button>
<Button
type="submit"
@@ -163,7 +167,9 @@ const WhatsAppModal = ({ open, onClose, whatsAppId }) => {
variant="contained"
className={classes.btnWrapper}
>
Save
{whatsAppId
? i18n.t("whatsappModal.buttons.okEdit")
: i18n.t("whatsappModal.buttons.okAdd")}
{isSubmitting && (
<CircularProgress
size={24}

View File

@@ -44,7 +44,7 @@ const MainListItems = () => {
<ListItemLink to="/" primary="Dashboard" icon={<DashboardIcon />} />
<ListItemLink
to="/connections"
primary="Connections"
primary={i18n.t("mainDrawer.listItems.connections")}
icon={<SyncAltIcon />}
/>
<ListItemLink
@@ -61,7 +61,9 @@ const MainListItems = () => {
{userProfile === "admin" && (
<>
<Divider />
<ListSubheader inset>Administration</ListSubheader>
<ListSubheader inset>
{i18n.t("mainDrawer.listItems.administration")}
</ListSubheader>
<ListItemLink
to="/users"
primary={i18n.t("mainDrawer.listItems.users")}

View File

@@ -20,6 +20,7 @@ import NotificationsPopOver from "../NotificationsPopOver";
import UserModal from "../UserModal";
import { AuthContext } from "../../context/Auth/AuthContext";
import BackdropLoading from "../BackdropLoading";
import { i18n } from "../../translate/i18n";
const drawerWidth = 240;
@@ -197,7 +198,7 @@ const LoggedInLayout = ({ appTitle, children }) => {
noWrap
className={classes.title}
>
WHATICKET
WhaTicket
</Typography>
<NotificationsPopOver />
@@ -226,8 +227,12 @@ const LoggedInLayout = ({ appTitle, children }) => {
open={menuOpen}
onClose={handleCloseMenu}
>
<MenuItem onClick={handleOpenUserModal}>Profile</MenuItem>
<MenuItem onClick={handleLogout}>Logout</MenuItem>
<MenuItem onClick={handleOpenUserModal}>
{i18n.t("mainDrawer.appBar.user.profile")}
</MenuItem>
<MenuItem onClick={handleLogout}>
{i18n.t("mainDrawer.appBar.user.logout")}
</MenuItem>
</Menu>
</div>
</Toolbar>