From fb1d2cf045b3828e071b8fa9000c2a2f9187143d Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Sat, 28 Mar 2020 12:21:33 +0100 Subject: [PATCH] Updated translations --- navigation/DrawerNavigator.js | 2 +- screens/Tetris/TetrisScreen.js | 29 +++++++++++++++-------------- translations/en.json | 20 ++++++++++++++++++++ translations/fr.json | 20 ++++++++++++++++++++ 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/navigation/DrawerNavigator.js b/navigation/DrawerNavigator.js index 71c7b34..0073467 100644 --- a/navigation/DrawerNavigator.js +++ b/navigation/DrawerNavigator.js @@ -177,7 +177,7 @@ function TetrisStackComponent() { options={({navigation}) => { const openDrawer = getDrawerButton.bind(this, navigation); return { - title: 'Tetris', + title: i18n.t("game.title"), headerLeft: openDrawer }; }} diff --git a/screens/Tetris/TetrisScreen.js b/screens/Tetris/TetrisScreen.js index 47e92b6..c6867c7 100644 --- a/screens/Tetris/TetrisScreen.js +++ b/screens/Tetris/TetrisScreen.js @@ -8,6 +8,7 @@ import GameLogic from "./GameLogic"; import Grid from "./components/Grid"; import HeaderButton from "../../components/HeaderButton"; import Preview from "./components/Preview"; +import i18n from "i18n-js"; type Props = { navigation: Object, @@ -136,11 +137,11 @@ class TetrisScreen extends React.Component { showPausePopup() { Alert.alert( - 'PAUSE', - 'GAME PAUSED', + i18n.t("game.pause"), + i18n.t("game.pauseMessage"), [ - {text: 'RESTART', onPress: () => this.showRestartConfirm()}, - {text: 'RESUME', onPress: () => this.togglePause()}, + {text: i18n.t("game.restart.text"), onPress: () => this.showRestartConfirm()}, + {text: i18n.t("game.resume"), onPress: () => this.togglePause()}, ], {cancelable: false}, ); @@ -148,26 +149,26 @@ class TetrisScreen extends React.Component { showRestartConfirm() { Alert.alert( - 'RESTART?', - 'WHOA THERE', + i18n.t("game.restart.confirm"), + i18n.t("game.restart.confirmMessage"), [ - {text: 'NO', onPress: () => this.showPausePopup()}, - {text: 'YES', onPress: () => this.startGame()}, + {text: i18n.t("game.restart.confirmNo"), onPress: () => this.showPausePopup()}, + {text: i18n.t("game.restart.confirmYes"), onPress: () => this.startGame()}, ], {cancelable: false}, ); } showGameOverConfirm() { - let message = 'SCORE: ' + this.state.gameScore + '\n'; - message += 'LEVEL: ' + this.state.gameLevel + '\n'; - message += 'TIME: ' + this.getFormattedTime(this.state.gameTime) + '\n'; + let message = i18n.t("game.gameOver.score") + this.state.gameScore + '\n'; + message += i18n.t("game.gameOver.level") + this.state.gameLevel + '\n'; + message += i18n.t("game.gameOver.time") + this.getFormattedTime(this.state.gameTime) + '\n'; Alert.alert( - 'GAME OVER', + i18n.t("game.gameOver.text"), message, [ - {text: 'LEAVE', onPress: () => this.props.navigation.goBack()}, - {text: 'RESTART', onPress: () => this.startGame()}, + {text: i18n.t("game.gameOver.exit"), onPress: () => this.props.navigation.goBack()}, + {text: i18n.t("game.restart.text"), onPress: () => this.startGame()}, ], {cancelable: false}, ); diff --git a/translations/en.json b/translations/en.json index 6bf72c7..e1fb992 100644 --- a/translations/en.json +++ b/translations/en.json @@ -235,5 +235,25 @@ "november": "November", "december": "December" } + }, + "game": { + "title": "Game", + "pause": "Game Paused", + "pauseMessage": "The game is paused", + "resume": "Resume", + "restart": { + "text": "Restart", + "confirm": "Are you sure you want to restart?", + "confirmMessage": "You will lose you progress, continue?", + "confirmYes": "Yes", + "confirmNo": "No" + }, + "gameOver": { + "text": "Game Over", + "score": "Score: ", + "level": "Level: ", + "time": "Time: ", + "exit": "leave Game" + } } } diff --git a/translations/fr.json b/translations/fr.json index 1c5d442..3887502 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -236,5 +236,25 @@ "november": "Novembre", "december": "Décembre" } + }, + "game": { + "title": "Jeu", + "pause": "Pause", + "pauseMessage": "Le jeu est en pause", + "resume": "Continuer", + "restart": { + "text": "Redémarrer", + "confirm": "Êtes vous sûr de vouloir redémarrer ?", + "confirmMessage": "Tout votre progrès sera perdu, continuer ?", + "confirmYes": "Oui", + "confirmNo": "Non" + }, + "gameOver": { + "text": "Game Over", + "score": "Score: ", + "level": "Niveau: ", + "time": "Temps: ", + "exit": "Quitter" + } } }