-
Notifications
You must be signed in to change notification settings - Fork 0
/
getDictionary.js
53 lines (39 loc) · 1.35 KB
/
getDictionary.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
// import test from './dictionaries/test.csv';
import en from './dictionaries/en.csv';
import de from './dictionaries/de.csv';
import sv from './dictionaries/sv.csv';
// const dictionaries = {
// en: () => import("./dictionaries/en.json").then(r => r.default),
// sv: () => import("./dictionaries/sv.json").then(r => r.default),
// de: () => import("./dictionaries/de.json").then(r => r.default)
// }
export const getDictionary = (lang) => {
if(lang == 'en'){
return en;
}else if(lang == 'sv'){
return sv;
}else if(lang == 'de'){
return de;
}else{
return en;
}
//console.log(test[0].key)
// const csvFilePath= dictionaries['en1']
// console.log(csvFilePath)
// Papa.parse(test, {
// complete: function(results) {
// console.log("Finished:", results.data);
// }
// });
// const reader = response.body.getReader();
// const result = await reader.read();
// const decoder = new TextDecoder("utf-8");
// const csvData = decoder.decode(result.value);
// console.log(decoder)
// const parsedData = Papa.parse(csvData, {
// header: false,
// skipEmptyLines: true
// });
// console.log(parsedData);
// return dictionaries[lang]();
}