-
Notifications
You must be signed in to change notification settings - Fork 0
/
Language.js
64 lines (50 loc) · 1.5 KB
/
Language.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import AsyncStorage from '@react-native-async-storage/async-storage';
const debugging_option = false;
async function getInputLanguage() {
if (debugging_option) {
console.log('getInputLanguage called');
}
// default to English
var inputLanguage = "english";
const result = await AsyncStorage.getItem('storedLanguage');
if (result) {
if (debugging_option) {
console.log('result: ');
console.log(result);
}
inputLanguage = result;
} else {
if (debugging_option) {
console.log('result error, default');
}
}
inputLanguage = inputLanguage.trim();
inputLanguage = inputLanguage.toLowerCase();
if (debugging_option) {
console.log('returning: ');
console.log(inputLanguage);
}
return inputLanguage;
}
function getGlobalLanguage() {
if (debugging_option) {
console.log('getGlobalLanguage called');
}
// default to English
var inputLanguage = "english";
if (global.language === undefined) {
if (debugging_option) {
console.log('Global Variable Language not defined, returning default');
}
} else {
inputLanguage = global.language;
}
inputLanguage = inputLanguage.trim();
inputLanguage = inputLanguage.toLowerCase();
if (debugging_option) {
console.log('returning: ');
console.log(inputLanguage);
}
return inputLanguage;
}
export {getInputLanguage, getGlobalLanguage}