1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-05 11:25:09 +01:00
onion/js/utils/lang_utils.js
2015-06-02 12:00:59 +02:00

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;