improvement: add translation to new components

This commit is contained in:
canove
2021-01-14 21:36:03 -03:00
parent 964ed649d7
commit af56447464
6 changed files with 49 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import Select from "@material-ui/core/Select";
import Chip from "@material-ui/core/Chip"; import Chip from "@material-ui/core/Chip";
import toastError from "../../errors/toastError"; import toastError from "../../errors/toastError";
import api from "../../services/api"; import api from "../../services/api";
import { i18n } from "../../translate/i18n";
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(theme => ({
chips: { chips: {
@@ -33,17 +34,17 @@ const QueueSelect = ({ selectedQueueIds, onChange }) => {
})(); })();
}, []); }, []);
const handleChange = event => { const handleChange = e => {
onChange(event.target.value); onChange(e.target.value);
}; };
return ( return (
<div style={{ marginTop: 6 }}> <div style={{ marginTop: 6 }}>
<FormControl fullWidth margin="dense" variant="outlined"> <FormControl fullWidth margin="dense" variant="outlined">
<InputLabel>Filas</InputLabel> <InputLabel>{i18n.t("queueSelect.inputLabel")}</InputLabel>
<Select <Select
multiple multiple
labelWidth={40} labelWidth={60}
value={selectedQueueIds} value={selectedQueueIds}
onChange={handleChange} onChange={handleChange}
MenuProps={{ MenuProps={{

View File

@@ -175,7 +175,7 @@ const TicketsManager = () => {
color="primary" color="primary"
onClick={() => setNewTicketModalOpen(true)} onClick={() => setNewTicketModalOpen(true)}
> >
Novo {i18n.t("ticketsManager.buttons.newTicket")}
</Button> </Button>
<Can <Can
role={user.profile} role={user.profile}

View File

@@ -4,6 +4,7 @@ import MenuItem from "@material-ui/core/MenuItem";
import FormControl from "@material-ui/core/FormControl"; import FormControl from "@material-ui/core/FormControl";
import Select from "@material-ui/core/Select"; import Select from "@material-ui/core/Select";
import { Checkbox, ListItemText } from "@material-ui/core"; import { Checkbox, ListItemText } from "@material-ui/core";
import { i18n } from "../../translate/i18n";
const TicketsQueueSelect = ({ const TicketsQueueSelect = ({
userQueues, userQueues,
@@ -34,7 +35,7 @@ const TicketsQueueSelect = ({
}, },
getContentAnchorEl: null, getContentAnchorEl: null,
}} }}
renderValue={() => "Filas"} renderValue={() => i18n.t("ticketsQueueSelect.placeholder")}
> >
{userQueues?.length > 0 && {userQueues?.length > 0 &&
userQueues.map(queue => ( userQueues.map(queue => (

View File

@@ -190,6 +190,14 @@ const messages = {
chat: { chat: {
noTicketMessage: "Select a ticket to start chatting.", noTicketMessage: "Select a ticket to start chatting.",
}, },
ticketsManager: {
buttons: {
newTicket: "New",
},
},
ticketsQueueSelect: {
placeholder: "Queues",
},
tickets: { tickets: {
toasts: { toasts: {
deleted: "The ticket you were on has been deleted.", deleted: "The ticket you were on has been deleted.",
@@ -274,6 +282,9 @@ const messages = {
"Are you sure? It cannot be reverted! Tickets in this queue will still exist, but will not have any queues assigned.", "Are you sure? It cannot be reverted! Tickets in this queue will still exist, but will not have any queues assigned.",
}, },
}, },
queueSelect: {
inputLabel: "Queues",
},
users: { users: {
title: "Users", title: "Users",
table: { table: {

View File

@@ -193,6 +193,14 @@ const messages = {
chat: { chat: {
noTicketMessage: "Selecciona un ticket para empezar a chatear.", noTicketMessage: "Selecciona un ticket para empezar a chatear.",
}, },
ticketsManager: {
buttons: {
newTicket: "Nuevo",
},
},
ticketsQueueSelect: {
placeholder: "Linhas",
},
tickets: { tickets: {
toasts: { toasts: {
deleted: "El ticket en el que estabas ha sido borrado.", deleted: "El ticket en el que estabas ha sido borrado.",
@@ -278,6 +286,9 @@ const messages = {
"¿Estás seguro? ¡Esta acción no se puede revertir! Los tickets en esa cola seguirán existiendo, pero ya no tendrán ninguna cola asignada.", "¿Estás seguro? ¡Esta acción no se puede revertir! Los tickets en esa cola seguirán existiendo, pero ya no tendrán ninguna cola asignada.",
}, },
}, },
queueSelect: {
inputLabel: "Linhas",
},
users: { users: {
title: "Usuarios", title: "Usuarios",
table: { table: {
@@ -395,6 +406,10 @@ const messages = {
ERR_CREATING_TICKET: "Error al crear el ticket en la base de datos.", ERR_CREATING_TICKET: "Error al crear el ticket en la base de datos.",
ERR_FETCH_WAPP_MSG: ERR_FETCH_WAPP_MSG:
"Error al obtener el mensaje en WhtasApp, tal vez sea demasiado antiguo.", "Error al obtener el mensaje en WhtasApp, tal vez sea demasiado antiguo.",
ERR_QUEUE_COLOR_ALREADY_EXISTS:
"Este color ya está en uso, elija otro.",
ERR_WAPP_GREETING_REQUIRED:
"El mensaje de saludo es obligatorio cuando hay más de una cola.",
}, },
}, },
}, },

View File

@@ -191,6 +191,14 @@ const messages = {
chat: { chat: {
noTicketMessage: "Selecione um ticket para começar a conversar.", noTicketMessage: "Selecione um ticket para começar a conversar.",
}, },
ticketsManager: {
buttons: {
newTicket: "Novo",
},
},
ticketsQueueSelect: {
placeholder: "Filas",
},
tickets: { tickets: {
toasts: { toasts: {
deleted: "O ticket que você estava foi deletado.", deleted: "O ticket que você estava foi deletado.",
@@ -276,6 +284,9 @@ const messages = {
"Você tem certeza? Essa ação não pode ser revertida! Os tickets dessa fila continuarão existindo, mas não terão mais nenhuma fila atribuída.", "Você tem certeza? Essa ação não pode ser revertida! Os tickets dessa fila continuarão existindo, mas não terão mais nenhuma fila atribuída.",
}, },
}, },
queueSelect: {
inputLabel: "Filas",
},
users: { users: {
title: "Usuários", title: "Usuários",
table: { table: {
@@ -391,6 +402,10 @@ const messages = {
ERR_CREATING_TICKET: "Erro ao criar tíquete no banco de dados.", ERR_CREATING_TICKET: "Erro ao criar tíquete no banco de dados.",
ERR_FETCH_WAPP_MSG: ERR_FETCH_WAPP_MSG:
"Erro ao buscar a mensagem no WhtasApp, talvez ela seja muito antiga.", "Erro ao buscar a mensagem no WhtasApp, talvez ela seja muito antiga.",
ERR_QUEUE_COLOR_ALREADY_EXISTS:
"Esta cor já está em uso, escolha outra.",
ERR_WAPP_GREETING_REQUIRED:
"A mensagem de saudação é obrigatório quando há mais de uma fila.",
}, },
}, },
}, },