mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +00:00
improvement: all app strings now using i18n
This commit is contained in:
@@ -1,20 +1,32 @@
|
|||||||
import React from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import Routes from "./routes";
|
import Routes from "./routes";
|
||||||
import "react-toastify/dist/ReactToastify.css";
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
|
|
||||||
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
|
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles";
|
||||||
import { ptBR } from "@material-ui/core/locale";
|
import { ptBR } from "@material-ui/core/locale";
|
||||||
|
|
||||||
const theme = createMuiTheme(
|
|
||||||
{
|
|
||||||
palette: {
|
|
||||||
primary: { main: "#1976d2" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
ptBR
|
|
||||||
);
|
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
|
const [locale, setLocale] = useState();
|
||||||
|
|
||||||
|
const theme = createMuiTheme(
|
||||||
|
{
|
||||||
|
palette: {
|
||||||
|
primary: { main: "#1976d2" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
locale
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const i18nlocale = localStorage.getItem("i18nextLng");
|
||||||
|
const browserLocale =
|
||||||
|
i18nlocale.substring(0, 2) + i18nlocale.substring(3, 5);
|
||||||
|
|
||||||
|
if (browserLocale === "ptBR") {
|
||||||
|
setLocale(ptBR);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<Routes />
|
<Routes />
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import Avatar from "@material-ui/core/Avatar";
|
|||||||
import Button from "@material-ui/core/Button";
|
import Button from "@material-ui/core/Button";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
|
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
import LinkifyWithTargetBlank from "../LinkifyWithTargetBlank";
|
import LinkifyWithTargetBlank from "../LinkifyWithTargetBlank";
|
||||||
import ContactModal from "../ContactModal";
|
import ContactModal from "../ContactModal";
|
||||||
import ContactDrawerSkeleton from "../ContactDrawerSkeleton";
|
import ContactDrawerSkeleton from "../ContactDrawerSkeleton";
|
||||||
@@ -123,7 +124,7 @@ const ContactDrawer = ({ open, handleDrawerClose, contact, loading }) => {
|
|||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Typography style={{ justifySelf: "center" }}>
|
<Typography style={{ justifySelf: "center" }}>
|
||||||
Dados do contato
|
{i18n.t("contactDrawer.header")}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
@@ -146,7 +147,7 @@ const ContactDrawer = ({ open, handleDrawerClose, contact, loading }) => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
onClick={e => setModalOpen(true)}
|
onClick={e => setModalOpen(true)}
|
||||||
>
|
>
|
||||||
Editar contato
|
{i18n.t("contactDrawer.buttons.edit")}
|
||||||
</Button>
|
</Button>
|
||||||
</Paper>
|
</Paper>
|
||||||
<Paper square variant="outlined" className={classes.contactDetails}>
|
<Paper square variant="outlined" className={classes.contactDetails}>
|
||||||
@@ -156,7 +157,9 @@ const ContactDrawer = ({ open, handleDrawerClose, contact, loading }) => {
|
|||||||
aria-labelledby="form-dialog-title"
|
aria-labelledby="form-dialog-title"
|
||||||
contactId={contact.id}
|
contactId={contact.id}
|
||||||
></ContactModal>
|
></ContactModal>
|
||||||
<Typography variant="subtitle1">Outras informações</Typography>
|
<Typography variant="subtitle1">
|
||||||
|
{i18n.t("contactDrawer.extraInfo")}
|
||||||
|
</Typography>
|
||||||
{contact &&
|
{contact &&
|
||||||
contact.extraInfo &&
|
contact.extraInfo &&
|
||||||
contact.extraInfo.map(info => (
|
contact.extraInfo.map(info => (
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import MicIcon from "@material-ui/icons/Mic";
|
|||||||
import CheckCircleOutlineIcon from "@material-ui/icons/CheckCircleOutline";
|
import CheckCircleOutlineIcon from "@material-ui/icons/CheckCircleOutline";
|
||||||
import HighlightOffIcon from "@material-ui/icons/HighlightOff";
|
import HighlightOffIcon from "@material-ui/icons/HighlightOff";
|
||||||
|
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
import RecordingTimer from "./RecordingTimer";
|
import RecordingTimer from "./RecordingTimer";
|
||||||
|
|
||||||
@@ -310,7 +311,7 @@ const MessageInput = () => {
|
|||||||
<InputBase
|
<InputBase
|
||||||
inputRef={input => input && input.focus()}
|
inputRef={input => input && input.focus()}
|
||||||
className={classes.messageInput}
|
className={classes.messageInput}
|
||||||
placeholder="Escreva uma mensagem"
|
placeholder={i18n.t("messagesInput.placeholder")}
|
||||||
multiline
|
multiline
|
||||||
rowsMax={5}
|
rowsMax={5}
|
||||||
value={inputMessage}
|
value={inputMessage}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import Skeleton from "@material-ui/lab/Skeleton";
|
|||||||
import IconButton from "@material-ui/core/IconButton";
|
import IconButton from "@material-ui/core/IconButton";
|
||||||
import MoreVertIcon from "@material-ui/icons/MoreVert";
|
import MoreVertIcon from "@material-ui/icons/MoreVert";
|
||||||
|
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
import ContactDrawer from "../ContactDrawer";
|
import ContactDrawer from "../ContactDrawer";
|
||||||
import whatsBackground from "../../assets/wa-background.png";
|
import whatsBackground from "../../assets/wa-background.png";
|
||||||
@@ -569,7 +570,10 @@ const MessagesList = () => {
|
|||||||
loading ? (
|
loading ? (
|
||||||
<Skeleton animation="wave" width={80} />
|
<Skeleton animation="wave" width={80} />
|
||||||
) : (
|
) : (
|
||||||
ticket.user && `Atribuído à: ${ticket.user.name}`
|
ticket.user &&
|
||||||
|
`${i18n.t("messagesList.header.assignedTo")} ${
|
||||||
|
ticket.user.name
|
||||||
|
}`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -581,7 +585,7 @@ const MessagesList = () => {
|
|||||||
size="small"
|
size="small"
|
||||||
onClick={e => handleUpdateTicketStatus(e, "open", userId)}
|
onClick={e => handleUpdateTicketStatus(e, "open", userId)}
|
||||||
>
|
>
|
||||||
Reabrir
|
{i18n.t("messagesList.header.buttons.reopen")}
|
||||||
</Button>
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@@ -590,7 +594,7 @@ const MessagesList = () => {
|
|||||||
size="small"
|
size="small"
|
||||||
onClick={e => handleUpdateTicketStatus(e, "pending", null)}
|
onClick={e => handleUpdateTicketStatus(e, "pending", null)}
|
||||||
>
|
>
|
||||||
Retornar
|
{i18n.t("messagesList.header.buttons.return")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
@@ -598,7 +602,7 @@ const MessagesList = () => {
|
|||||||
color="primary"
|
color="primary"
|
||||||
onClick={e => handleUpdateTicketStatus(e, "closed", userId)}
|
onClick={e => handleUpdateTicketStatus(e, "closed", userId)}
|
||||||
>
|
>
|
||||||
Resolver
|
{i18n.t("messagesList.header.buttons.resolve")}
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { toast } from "react-toastify";
|
|||||||
import MenuItem from "@material-ui/core/MenuItem";
|
import MenuItem from "@material-ui/core/MenuItem";
|
||||||
import Menu from "@material-ui/core/Menu";
|
import Menu from "@material-ui/core/Menu";
|
||||||
|
|
||||||
|
import { i18n } from "../../translate/i18n";
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
import ConfirmationModal from "../ConfirmationModal";
|
import ConfirmationModal from "../ConfirmationModal";
|
||||||
|
|
||||||
@@ -47,8 +48,12 @@ const TicketOptionsMenu = ({ ticket, menuOpen, handleClose, anchorEl }) => {
|
|||||||
open={menuOpen}
|
open={menuOpen}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={handleOpenConfirmationModal}>Deletar</MenuItem>
|
<MenuItem onClick={handleOpenConfirmationModal}>
|
||||||
<MenuItem onClick={handleTransferTicket}>Transferir</MenuItem>
|
{i18n.t("ticketOptionsMenu.delete")}
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem onClick={handleTransferTicket}>
|
||||||
|
{i18n.t("ticketOptionsMenu.transfer")}
|
||||||
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<ConfirmationModal
|
<ConfirmationModal
|
||||||
title={`Deletar o ticket #${ticket.id} do contato ${ticket.contact.name}?`}
|
title={`Deletar o ticket #${ticket.id} do contato ${ticket.contact.name}?`}
|
||||||
|
|||||||
@@ -147,6 +147,30 @@ const messages = {
|
|||||||
contacts: "Contatos",
|
contacts: "Contatos",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
messagesList: {
|
||||||
|
header: {
|
||||||
|
assignedTo: "Atribuído à:",
|
||||||
|
buttons: {
|
||||||
|
return: "Retornar",
|
||||||
|
resolve: "Resolver",
|
||||||
|
reopen: "Reabrir",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messagesInput: {
|
||||||
|
placeholder: "Digite uma mensagem",
|
||||||
|
},
|
||||||
|
contactDrawer: {
|
||||||
|
header: "Dados do contato",
|
||||||
|
buttons: {
|
||||||
|
edit: "Editar contato",
|
||||||
|
},
|
||||||
|
extraInfo: "Outras informações",
|
||||||
|
},
|
||||||
|
ticketOptionsMenu: {
|
||||||
|
delete: "Deletar",
|
||||||
|
transfer: "Transferir",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user