1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 18:35:09 +01:00

include lodash.templates

This commit is contained in:
Tim Daubenschütz 2015-06-02 12:00:59 +02:00
parent f2d9f3b115
commit 777857b50c
2 changed files with 14 additions and 8 deletions

View File

@ -1,12 +1,17 @@
import languages from '../constants/languages'; import languages from '../constants/languages';
import template from 'lodash.template';
let getText = function(s) { let getText = function(s, ...args) {
let lang = navigator.language || navigator.userLanguage; let lang = navigator.language || navigator.userLanguage;
if(lang in languages && s in languages[lang]) { try {
if(lang in languages) {
return languages[lang][s]; return languages[lang][s];
} else { } else {
throw new Error('Your language is not supported.'); // just use the english language
// How ironic that this error is thrown in the english language... return languages['en-US'][s];
}
} catch(err) {
console.error(err);
} }
}; };

View File

@ -30,11 +30,12 @@
"alt": "^0.16.5", "alt": "^0.16.5",
"classnames": "^1.2.2", "classnames": "^1.2.2",
"isomorphic-fetch": "^2.0.2", "isomorphic-fetch": "^2.0.2",
"lodash.template": "^3.6.1",
"object-assign": "^2.0.0", "object-assign": "^2.0.0",
"react": "^0.13.2", "react": "^0.13.2",
"react-bootstrap": "~0.22.6",
"react-router": "^0.13.3", "react-router": "^0.13.3",
"uglifyjs": "^2.4.10", "uglifyjs": "^2.4.10"
"react-bootstrap": "~0.22.6"
}, },
"jest": { "jest": {
"scriptPreprocessor": "node_modules/babel-jest", "scriptPreprocessor": "node_modules/babel-jest",