Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add localization support (Js strings only) and Spanish translations.
- Loading branch information
1 parent
a4d573b
commit 3892e66
Showing
6 changed files
with
49 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| const catalog = { | ||
| 'es': { | ||
| 'Loading...': 'Cargando...', | ||
| 'Player': 'Jugador', | ||
| 'Click or Press Enter to Start': 'Click o Enter para empezar', | ||
| 'DINO NEEDS DUCKETS': '¡DINO NECESITA MONEDAS', | ||
| 'TO BUY SPACESHIP!': 'PARA COMPRAR SU NAVE!', | ||
| 'Fill ducket bucket': '¡Llena el monedero', | ||
| 'to escape meteor!': 'para escapar del meteoro!', | ||
| 'Press Enter to Start': 'Pulsa Enter para Empezar', | ||
| 'Collect and Deposit Coins!': '¡Recolecta y Deposita Monedas!', | ||
| 'Deposit Coins Here!': '¡Deposita las Monedas Aquí!', | ||
| 'SCORE': 'PUNTAJE', | ||
| 'GAME OVER!': '¡FIN DEL JUEGO!', | ||
| 'PRESS R TO TRY AGAIN!': '¡PULSA R PARA REINTENTAR!', | ||
| 'PRESS ESC TO GO BACK TO MAIN MENU!': '¡PULSA ESC PARA VOLVER AL MENU!', | ||
| 'HIGH SCORES': 'MAXIMOS PUNTAJES', | ||
| }, | ||
| }; | ||
|
|
||
| function gettext(str) { | ||
| const lang = navigator.language.split('-')[0]; | ||
| if (catalog.hasOwnProperty(lang)) { | ||
| if (catalog[lang].hasOwnProperty(str)) { | ||
| return catalog[lang][str]; | ||
| } | ||
| } | ||
| return str; | ||
| } | ||
|
|
||
| const _ = gettext; |