mirror of
https://github.com/ascribe/onion.git
synced 2025-01-05 11:25:09 +01:00
18 lines
462 B
JavaScript
18 lines
462 B
JavaScript
import languages from '../constants/languages';
|
|
import template from 'lodash.template';
|
|
|
|
let getText = function(s, ...args) {
|
|
let lang = navigator.language || navigator.userLanguage;
|
|
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);
|
|
}
|
|
};
|
|
|
|
export default getText; |