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:
parent
f2d9f3b115
commit
777857b50c
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user