diff --git a/public/locale/i18n/config.js b/i18n.config.js similarity index 91% rename from public/locale/i18n/config.js rename to i18n.config.js index 6f1a2e8..d13f3de 100644 --- a/public/locale/i18n/config.js +++ b/i18n.config.js @@ -9,7 +9,7 @@ module.exports = { '!app/i18n/**', '!**/node_modules/**', ], - output: './', + output: '.', options: { debug: true, func: { @@ -32,15 +32,15 @@ module.exports = { }, lngs: ['en','fr','es'], ns: [ - 'locale', - 'resource' + 'resource', + 'common' ], defaultLng: 'en', defaultNs: 'resource', defaultValue: '__STRING_NOT_TRANSLATED__', resource: { - loadPath: 'i18n/{{lng}}/{{ns}}.json', - savePath: 'i18n/{{lng}}/{{ns}}.json', + loadPath: './public/locale/i18n/{{lng}}/{{ns}}.json', + savePath: './public/locale/i18n/{{lng}}/{{ns}}.json', jsonIndent: 2, lineEnding: '\n' }, diff --git a/make_translation.sh b/make_translation.sh index 9a38a3d..8a2c757 100755 --- a/make_translation.sh +++ b/make_translation.sh @@ -1 +1 @@ -i18next-scanner --config locale/i18n/config.js --output locale/ 'src/**/*.{js,jsx}' +i18next-scanner --config i18n.config.js 'src/**/*.{js,jsx}' diff --git a/public/locale/i18n/en/common.json b/public/locale/i18n/en/common.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/public/locale/i18n/en/common.json @@ -0,0 +1 @@ +{} diff --git a/public/locale/i18n/en/resource.json b/public/locale/i18n/en/resource.json index dfb64c9..004fa00 100644 --- a/public/locale/i18n/en/resource.json +++ b/public/locale/i18n/en/resource.json @@ -49,5 +49,22 @@ "Go back to homepage": "Go back to homepage", "You have to judge every candidate/proposal!": "You have to judge every candidate/proposal!", "Your participation was recorded with success!": "Your participation was recorded with success!", - "Thanks for your participation.": "__STRING_NOT_TRANSLATED__" + "Thanks for your participation.": "Thanks for your participation.", + "Ending date:": "Ending date:", + "Excellent": "Excellent", + "Very good": "Very good", + "Good": "Good", + "Fair": "Fair", + "Passable": "Passable", + "Insufficient": "Insufficient", + "To reject": "To reject", + "Dates": "Dates", + "The election will take place from": "The election will take place from", + "at": "at", + "to": "to", + "Grades": "Grades", + "Voters' list": "Voters' list", + "Graph": "Graph", + "Preference profile": "Preference profile", + "Results of the election:": "Results of the election:" } diff --git a/public/locale/i18n/es/common.json b/public/locale/i18n/es/common.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/public/locale/i18n/es/common.json @@ -0,0 +1 @@ +{} diff --git a/public/locale/i18n/es/resource.json b/public/locale/i18n/es/resource.json index 9f7ab87..da34af1 100644 --- a/public/locale/i18n/es/resource.json +++ b/public/locale/i18n/es/resource.json @@ -2,25 +2,25 @@ "Homepage": "Página de inicio", "Source code": "Código fuente", "Who are we": "Quiénes somos", - "BetterVote": "Votar mejor", + "BetterVote": "VotarMejor", "Voting platform": "Plataforma de votación", "Majority Judgment": "Juicio Mayoritario", "Start an election": "Iniciar una elección", - "Candidate/proposal name...": "Nombre del(la) candidato(a)/propuesta", + "Candidate/proposal name...": "Nombre del(la) candidato(a)/propuesta...", "Delete?": "Borrar?", "Are you sure to delete": "Estás seguro de quierer borrar", "the row": "la fila", "Write here your question or introduce simple your election (250 characters max.)": "Escriba aquí su pregunta o introduzca simplemente su elección (250 caracteres máx.)", - "Please add at least 2 candidates.": "Por favor, añada al menos dos canidatos(as)", + "Please add at least 2 candidates.": "Por favor, añada al menos dos canidatos(as).", "Question of the election": "Pregunta de su elección", "Write here the question of your election": "Escriba aquí la pregunta de su elección", - "For example:": "Por ejemplo", + "For example:": "Por ejemplo:", "For the role of my representative, I judge this candidate...": "Para ser mi representante, yo elijo a este(a) candidato(a)....", "Candidates/Proposals": "Candidatos(as)/Propuestas", "Add a proposal": "Añadir una propuesta", "Advanced options": "Opciones avanzadas", - "Starting date:": "Fecha de inicio", - "Ending date: ": "Fecha de finalización", + "Starting date:": "Fecha de inicio:", + "Ending date: ": "Fecha de finalización: ", "Grades:": "Escala", "You can select here the number of grades for your election": "Puede seleccionar aquí el número de niveles de la escala para su elección", "5 = Excellent, Very good, Good, Fair, Passable": "5 == Excelente, Muy bien, Bien, Regular, Pasable", @@ -49,5 +49,22 @@ "Go back to homepage": "Vuelve a la página de inicio", "You have to judge every candidate/proposal!": "¡Tienes que evaluar a todos los(as) candidatos(as)/propuestas", "Your participation was recorded with success!": "¡Su participación fue registrada con éxito!", - "Thanks for your participation.": "Muchas gracias por participar" -} \ No newline at end of file + "Thanks for your participation.": "Muchas gracias por participar", + "Ending date:": "Fecha de finalización:", + "Excellent": "Excelente", + "Very good": "Muy bien", + "Good": "Bien", + "Fair": "Regular", + "Passable": "Pasable", + "Insufficient": "Insuficiente", + "To reject": "Rechazar", + "Dates": "Fechas", + "The election will take place from": "La elección tendrá lugar de las", + "at": "a las", + "to": "hasta", + "Grades": "Escala", + "Voters' list": "Lista de votantes", + "Graph": "Gráfico", + "Preference profile": "Perfil de preferencia", + "Results of the election:": "Resultados de la elección" +} diff --git a/public/locale/i18n/fr/common.json b/public/locale/i18n/fr/common.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/public/locale/i18n/fr/common.json @@ -0,0 +1 @@ +{} diff --git a/public/locale/i18n/fr/resource.json b/public/locale/i18n/fr/resource.json index 576e460..ca550c9 100644 --- a/public/locale/i18n/fr/resource.json +++ b/public/locale/i18n/fr/resource.json @@ -50,5 +50,21 @@ "Go back to homepage": "Revenir à la page d'accueil", "You have to judge every candidate/proposal!": "Vous devez évaluer tous les candidats/propositions !", "Your participation was recorded with success!": "Votre participation a été enregistrée avec succès !", - "Thanks for your participation.": "Merci de votre participation." + "Thanks for your participation.": "Merci de votre participation.", + "Excellent": "Excellent", + "Very good": "Très bien", + "Good": "Bien", + "Fair": "Assez bien", + "Passable": "Passable", + "Insufficient": "Insuffisant", + "To reject": "A rejeter", + "Dates": "Dates", + "The election will take place from": "Le vote se déroulera du", + "at": "à", + "to": "au", + "Grades": "Mentions", + "Voters' list": "Listes des électeurs", + "Graph": "Grahique", + "Preference profile": "Profil de mérites", + "Results of the election:": "Résultats de l'élection" } diff --git a/src/App.jsx b/src/App.jsx index 81baded..31899b7 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,18 +1,12 @@ import React, {Suspense} from 'react'; import {BrowserRouter as Router} from 'react-router-dom'; -import 'react-loader-spinner/dist/loader/css/react-spinner-loader.css'; import Loader from './components/loader'; import Routes from './Routes'; import Header from './components/layouts/Header'; import Footer from './components/layouts/Footer'; import AppContextProvider from './AppContext'; -import {i18n} from './i18n'; - -// const Spinner = ( -// -// ); function App() { return ( diff --git a/src/Util.jsx b/src/Util.jsx index 779b66a..e3efb93 100644 --- a/src/Util.jsx +++ b/src/Util.jsx @@ -1,3 +1,5 @@ +import i18n from './i18n.jsx'; + const colors = [ "#015411", "#019812", @@ -7,7 +9,25 @@ const colors = [ "#b20616", "#6f0214" ]; -export const grades = process.env.REACT_APP_GRADES.split(", ").map((e, i) => ({ - label: e, + +const gradeNames = [ + "Excellent", + "Very good", + "Good", + "Fair", + "Passable", + "Insufficient", + "To reject", +]; + +export const grades = gradeNames.map((name, i) => ({ + label: name, color: colors[i] })); + +export const i18nGrades = () => { + return gradeNames.map((name, i) => ({ + label: i18n.t(name), + color: colors[i] + })); +}; diff --git a/src/components/views/CreateElection.jsx b/src/components/views/CreateElection.jsx index 8aa689a..e85e496 100644 --- a/src/components/views/CreateElection.jsx +++ b/src/components/views/CreateElection.jsx @@ -36,7 +36,7 @@ import { faCogs, } from '@fortawesome/free-solid-svg-icons'; -import {grades} from '../../Util'; +import {i18nGrades} from '../../Util'; import {ReactMultiEmail, isEmail} from 'react-multi-email'; import 'react-multi-email/style.css'; import {AppContext} from '../../AppContext'; @@ -273,6 +273,8 @@ class CreateElection extends Component { const {electorEmails} = this.state; const {t} = this.props; + const grades = i18nGrades(); + if (successCreate) return ; return ( @@ -385,7 +387,7 @@ class CreateElection extends Component { ), }) }> - {Array(22) + {Array(24) .fill(1) .map((x, i) => (