documentation

This commit is contained in:
Tim Daubenschütz 2015-06-02 14:33:30 +02:00
parent fd0b3c0ead
commit b5c434aa18
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,12 @@ import languages from '../constants/languages';
import { formatText } from './general_utils';
/**
* Is used to translate strings to another language. Basically can be used with C's string format method.
* @param {string} s The string you want to translate
* @param {array} args An array of arguments (essentially JavaScript's this.arguments) that can be used to substitute digits and other strings
* @return {string} The formated string
*/
export function getLangText(s, ...args) {
let lang = navigator.language || navigator.userLanguage;
// this is just for testing, as changing the navigator.language wasn't possible