1
0
mirror of https://github.com/ascribe/onion.git synced 2024-09-28 03:58:55 +02:00

Merge branch 'AD-499-whitelabel-prize-with-sluice-as-k' of bitbucket.org:ascribe/onion into AD-499-whitelabel-prize-with-sluice-as-k

This commit is contained in:
Tim Daubenschütz 2015-07-15 16:55:27 +02:00
commit 06c2e6205c
2 changed files with 12 additions and 6 deletions

View File

@ -104,7 +104,7 @@ let AccountSettings = React.createClass({
show={true}
defaultExpanded={true}>
{content}
<Form
{/*<Form
url={AppConstants.serverUrl + 'api/users/set_language/'}>
<Property
name='language'
@ -121,7 +121,7 @@ let AccountSettings = React.createClass({
</select>
</Property>
<hr />
</Form>
</Form>*/}
</CollapsibleParagraph>
);
}

View File

@ -4,6 +4,14 @@ import languages from '../constants/languages';
import { formatText } from './general_utils';
export function getLang() {
// this is just for testing, as changing the navigator.language wasn't possible
// return 'fr';
return navigator.languages ? navigator.languages[0] :
(navigator.language || navigator.userLanguage);
}
/**
* 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
@ -11,9 +19,7 @@ import { formatText } from './general_utils';
* @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
//ang = 'de';
let lang = getLang();
try {
if(lang in languages) {
return formatText(languages[lang][s], args);