Skip to content

Commit

Permalink
feat: exporting languages with names.
Browse files Browse the repository at this point in the history
  • Loading branch information
vetom committed Sep 13, 2018
1 parent 1e49dfb commit 79e5efa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/data/translations.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"en" : {
"name": "English",
"calls" : {
"apprentice_seer" : "*Apprentice Seer, open your eyes.",
"aura_seer" : "Aura Seer open your eyes, check a player.",
Expand Down Expand Up @@ -169,6 +170,7 @@
},

"es" : {
"name": "Español",
"calls" : {
"apprentice_seer" : "*Aprendiz Vidente, abre tus ojos.",
"aura_seer" : "Vidente Aura levántate, verifica un jugador.",
Expand Down
6 changes: 5 additions & 1 deletion src/languages.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
const languages = require('./data/translations');

exports.get = (lang = 'en') => languages[lang] || {};
exports.getLanguages = () => Object.keys(languages);
exports.getLanguages = () => Object.keys(languages).map(k => ({
key: k,
value: languages[k].name
}));

exports.translateDeck = function translateDeck(deck, lang = 'en') {
const pack = languages[lang];
const cards = Object.keys(deck);
Expand Down

0 comments on commit 79e5efa

Please sign in to comment.