From 48fdca72c0b4f9bba1e1a815a4df3c6dcfa0c39d Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Tue, 7 Apr 2020 16:09:39 +0200 Subject: [PATCH] updated translations --- src/components/Amicale/Vote/VoteResults.js | 9 ++--- src/components/Amicale/Vote/VoteSelect.js | 13 +++---- src/components/Amicale/Vote/VoteTease.js | 8 ++--- src/components/Amicale/Vote/VoteTitle.js | 14 +++----- src/components/Amicale/Vote/VoteWait.js | 16 +++++---- src/components/Sidebar/Sidebar.js | 2 +- src/navigation/DrawerNavigator.js | 2 +- src/screens/Amicale/VoteScreen.js | 9 ++--- translations/en.json | 41 ++++++++++++++++++++-- translations/fr.json | 39 +++++++++++++++++++- 10 files changed, 114 insertions(+), 39 deletions(-) diff --git a/src/components/Amicale/Vote/VoteResults.js b/src/components/Amicale/Vote/VoteResults.js index 18a6036..5e47f3d 100644 --- a/src/components/Amicale/Vote/VoteResults.js +++ b/src/components/Amicale/Vote/VoteResults.js @@ -3,6 +3,7 @@ import * as React from 'react'; import {Avatar, Card, List, ProgressBar, Subheading, withTheme} from "react-native-paper"; import {FlatList, StyleSheet} from "react-native"; +import i18n from 'i18n-js'; type Props = { teams: Array, @@ -51,7 +52,7 @@ class VoteResults extends React.Component { }}> isWinner ? : null} @@ -71,15 +72,15 @@ class VoteResults extends React.Component { return ( } /> - TOTAL VOTES : {this.totalVotes} + {i18n.t('voteScreen.results.totalVotes') + ' ' +this.totalVotes} {/*$FlowFixMe*/} , @@ -74,8 +75,8 @@ export default class VoteSelect extends React.PureComponent { { style={{marginLeft: 'auto'}} disabled={this.state.selectedTeam === "none"} > - SEND VOTE + {i18n.t('voteScreen.select.sendButton')} @@ -111,9 +112,9 @@ export default class VoteSelect extends React.PureComponent { visible={this.state.voteDialogVisible} onDismiss={this.onVoteDialogDismiss} onAccept={this.onVoteDialogAccept} - title={"VOTE?"} - titleLoading={"SENDING VOTE..."} - message={"SURE?"} + title={i18n.t('voteScreen.select.dialogTitle')} + titleLoading={i18n.t('voteScreen.select.dialogTitleLoading')} + message={i18n.t('voteScreen.select.dialogMessage')} /> { return ( } /> - VOTE STARTS - AT {this.props.startDate} + {i18n.t('voteScreen.tease.message') + ' ' + this.props.startDate} diff --git a/src/components/Amicale/Vote/VoteTitle.js b/src/components/Amicale/Vote/VoteTitle.js index d81b333..16ab14e 100644 --- a/src/components/Amicale/Vote/VoteTitle.js +++ b/src/components/Amicale/Vote/VoteTitle.js @@ -3,6 +3,7 @@ import * as React from 'react'; import {Avatar, Card, Paragraph} from "react-native-paper"; import {StyleSheet} from "react-native"; +import i18n from 'i18n-js'; const ICON_AMICALE = require('../../../../assets/amicale.png'); @@ -18,8 +19,8 @@ export default class VoteTitle extends React.Component { return ( { /> - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus porttitor - suscipit. Quisque hendrerit, quam id vestibulum vestibulum, lorem nisi hendrerit nisi, a - eleifend sapien diam ut elit. Curabitur sit amet vulputate lectus. Donec semper cursus sapien - vel finibus. + {i18n.t('voteScreen.title.paragraph1')} - Sed et venenatis turpis. Fusce malesuada magna urna, sed vehicula sem luctus in. Vivamus - faucibus vel eros a ultricies. In sed laoreet ante, luctus mattis tellus. Etiam vitae ipsum - sagittis, consequat purus sed, blandit risus. + {i18n.t('voteScreen.title.paragraph2')} diff --git a/src/components/Amicale/Vote/VoteWait.js b/src/components/Amicale/Vote/VoteWait.js index e098029..a2129dd 100644 --- a/src/components/Amicale/Vote/VoteWait.js +++ b/src/components/Amicale/Vote/VoteWait.js @@ -3,6 +3,7 @@ import * as React from 'react'; import {ActivityIndicator, Card, Paragraph, withTheme} from "react-native-paper"; import {StyleSheet} from "react-native"; +import i18n from 'i18n-js'; type Props = { startDate: string | null, @@ -28,32 +29,33 @@ class VoteWait extends React.Component { return ( } /> { this.props.justVoted ? - VOTE SUBMITTED. THX FOR YOUR PARTICIPATION + {i18n.t('voteScreen.wait.messageSubmitted')} : null } { this.props.hasVoted ? - THX FOR THE VOTE + {i18n.t('voteScreen.wait.messageVoted')} : null } { this.props.startDate !== null ? - RESULTS AVAILABLE - AT {this.props.startDate} + {i18n.t('voteScreen.wait.messageDate') + ' ' + this.props.startDate} - : RESULTS AVAILABLE SHORTLY + : {i18n.t('voteScreen.wait.messageDateUndefined')} } diff --git a/src/components/Sidebar/Sidebar.js b/src/components/Sidebar/Sidebar.js index 6f4b016..90e3d76 100644 --- a/src/components/Sidebar/Sidebar.js +++ b/src/components/Sidebar/Sidebar.js @@ -70,7 +70,7 @@ class SideBar extends React.Component { onlyWhenLoggedIn: true, }, { - name: "VOTE", + name: i18n.t('screens.vote'), route: "VoteScreen", icon: "vote", onlyWhenLoggedIn: true, diff --git a/src/navigation/DrawerNavigator.js b/src/navigation/DrawerNavigator.js index b40f180..2d939e0 100644 --- a/src/navigation/DrawerNavigator.js +++ b/src/navigation/DrawerNavigator.js @@ -256,7 +256,7 @@ function VoteStackComponent() { options={({navigation}) => { const openDrawer = getDrawerButton.bind(this, navigation); return { - title: "VoteScreen", + title: i18n.t('screens.vote'), headerLeft: openDrawer }; }} diff --git a/src/screens/Amicale/VoteScreen.js b/src/screens/Amicale/VoteScreen.js index 406b7f9..5b603a5 100644 --- a/src/screens/Amicale/VoteScreen.js +++ b/src/screens/Amicale/VoteScreen.js @@ -11,9 +11,9 @@ import VoteResults from "../../components/Amicale/Vote/VoteResults"; import VoteWait from "../../components/Amicale/Vote/VoteWait"; const FAKE_DATE = { - "date_begin": "2020-04-06 21:50", - "date_end": "2020-04-07 23:50", - "date_result_begin": "2020-04-07 21:50", + "date_begin": "2020-04-07 21:50", + "date_end": "2020-04-06 23:50", + "date_result_begin": "2020-04-06 21:50", "date_result_end": "2020-04-07 22:50", }; @@ -201,7 +201,8 @@ export default class VoteScreen extends React.Component { let startDate = null; if (this.dates.date_result_begin !== null) startDate = this.getDateString(this.dates.date_result_begin, this.datesString.date_result_begin); - return ; } diff --git a/translations/en.json b/translations/en.json index 944f4d9..df664ee 100644 --- a/translations/en.json +++ b/translations/en.json @@ -15,7 +15,8 @@ "debug": "Debug", "login": "Login", "logout": "Logout", - "profile": "Profile" + "profile": "Profile", + "vote": "Elections" }, "sidenav": { "divider1": "Student websites", @@ -236,7 +237,7 @@ "whyAccountSub": "What can you do wth an account", "whyAccountParagraph": "An Amicale account allows you to take part in several activities around campus. You can join a club, or even create your own!", "whyAccountParagraph2": "Logging into your Amicale account on the app will allow you to see all available clubs on the campus, vote for the upcoming elections, and more to come!", - "noAccount": "No Account? Go to the Amicale's building during open hours to create one.", + "noAccount": "No Account? Go to the Amicale's building during open hours to create one." }, "errors": { "title": "Error!", @@ -257,6 +258,42 @@ "categories": "Categories", "categoriesFilterMessage": "Click on a category to filter the list" }, + "voteScreen": { + "select": { + "title": "Elections open", + "subtitle": "Vote now!", + "sendButton": "Send Vote", + "dialogTitle": "Send Vote?", + "dialogTitleLoading": "Sending vote...", + "dialogMessage": "Are you sure you want to send your vote? You will not be able to change it." + }, + "tease": { + "title": "Elections incoming", + "subtitle": "Be ready to vote!", + "message" : "Vote start:" + }, + "wait": { + "titleSubmitted": "Vote submitted!", + "titleEnded": "Votes closed", + "subtitle" : "Waiting for results...", + "messageSubmitted" : "Vote submitted successfully.", + "messageVoted" : "Thank you for your participation.", + "messageDate" : "Results available:", + "messageDateUndefined" : "Results will be available shortly" + }, + "results": { + "title": "Results", + "subtitle": "Available until:", + "totalVotes" : "Total votes:", + "votes" : "votes" + }, + "title": { + "title": "The Elections", + "subtitle": "Why your vote is important", + "paragraph1" : "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus porttitor suscipit. Quisque hendrerit, quam id vestibulum vestibulum, lorem nisi hendrerit nisi, a eleifend sapien diam ut elit. Curabitur sit amet vulputate lectus. Donec semper cursus sapienvel finibus.", + "paragraph2" : "Sed et venenatis turpis. Fusce malesuada magna urna, sed vehicula sem luctus in. Vivamus faucibus vel eros a ultricies. In sed laoreet ante, luctus mattis tellus. Etiam vitae ipsum sagittis, consequat purus sed, blandit risus." + } + }, "dialog": { "ok": "OK", "yes": "Yes", diff --git a/translations/fr.json b/translations/fr.json index 76ac6c1..0834878 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -15,7 +15,8 @@ "debug": "Debug", "login": "Se Connecter", "logout": "Se Déconnecter", - "profile": "Profil" + "profile": "Profil", + "vote": "Élections" }, "sidenav": { "divider1": "Sites étudiants", @@ -257,6 +258,42 @@ "categories": "Catégories", "categoriesFilterMessage": "Cliquez sur une catégorie pour filtrer la liste" }, + "voteScreen": { + "select": { + "title": "Élections ouvertes", + "subtitle": "Votez maintenant !", + "sendButton": "Envoyer votre vote", + "dialogTitle": "Envoyer votre vote ?", + "dialogTitleLoading": "Envoi du vote...", + "dialogMessage": "Êtes vous sûr de vouloir envoyer votre vote ? Vous ne pourrez plus le changer." + }, + "tease": { + "title": "Les élections arrivent", + "subtitle": "Préparez vous à voter !", + "message" : "Début des votes :" + }, + "wait": { + "titleSubmitted": "Vote envoyé !", + "titleEnded": "Votes fermés", + "subtitle" : "Attente des résultats...", + "messageSubmitted" : "Votre vote a bien été envoyé.", + "messageVoted" : "Merci pour votre participation.", + "messageDate" : "Disponibilité des résultats :", + "messageDateUndefined" : "les résultats seront disponibles sous peu." + }, + "results": { + "title": "Résultats", + "subtitle": "Disponibles jusqu'à :", + "totalVotes" : "Nombre total de votes :", + "votes" : "votes" + }, + "title": { + "title": "Les Élections", + "subtitle": "Pourquoi votre vote est important", + "paragraph1" : "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus porttitor suscipit. Quisque hendrerit, quam id vestibulum vestibulum, lorem nisi hendrerit nisi, a eleifend sapien diam ut elit. Curabitur sit amet vulputate lectus. Donec semper cursus sapienvel finibus.", + "paragraph2" : "Sed et venenatis turpis. Fusce malesuada magna urna, sed vehicula sem luctus in. Vivamus faucibus vel eros a ultricies. In sed laoreet ante, luctus mattis tellus. Etiam vitae ipsum sagittis, consequat purus sed, blandit risus." + } + }, "dialog": { "ok": "OK", "yes": "Oui",