1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +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 template from 'lodash.template';
let getText = function(s) {
let getText = function(s, ...args) {
let lang = navigator.language || navigator.userLanguage;
if(lang in languages && s in languages[lang]) {
return languages[lang][s];
} else {
throw new Error('Your language is not supported.');
// How ironic that this error is thrown in the english language...
try {
if(lang in languages) {
return languages[lang][s];
} else {
// just use the english language
return languages['en-US'][s];
}
} catch(err) {
console.error(err);
}
};

View File

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