-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
97 lines (85 loc) · 2.54 KB
/
index.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* eslint-disable import/no-unresolved */
import propertiesToJSON from 'properties-to-json';
// This is imported using Fusebox's raw plugin, make sure to include .properties in your fusebox config
import enMessages from './messages/en-US/strings.properties';
import viMessages from './messages/vi/strings.properties';
import jaMessages from './messages/ja/strings.properties';
import koMessages from './messages/ko/strings.properties';
import trMessages from './messages/tr/strings.properties';
import thMessages from './messages/th/strings.properties';
import ruMessages from './messages/ru/strings.properties';
import ptBRMessages from './messages/pt-BR/strings.properties';
import esMessages from './messages/es/strings.properties';
import idMessages from './messages/id/strings.properties';
function returnMessagesFromPropertiesFile(rawPropertiesString) {
let parsedTranslations;
if (typeof rawPropertiesString === 'string') {
parsedTranslations = propertiesToJSON(rawPropertiesString);
} else {
parsedTranslations = propertiesToJSON(rawPropertiesString.default);
}
return parsedTranslations;
}
export default [
{
name: 'English',
locale: 'en-US',
contentfulLocale: 'en-US',
defaultLocale: true,
messages: returnMessagesFromPropertiesFile(enMessages),
},
{
name: 'Tiếng Việt',
locale: 'vi',
contentfulLocale: 'vi',
messages: returnMessagesFromPropertiesFile(viMessages),
},
{
name: '日本語',
locale: 'ja',
contentfulLocale: 'ja-JP',
messages: returnMessagesFromPropertiesFile(jaMessages),
},
{
name: '한국어',
locale: 'ko',
contentfulLocale: 'ko-KR',
messages: returnMessagesFromPropertiesFile(koMessages),
},
{
name: 'Türkçe',
locale: 'tr',
contentfulLocale: 'tr-TR',
messages: returnMessagesFromPropertiesFile(trMessages),
},
{
name: 'ภาษาไทย',
locale: 'th',
contentfulLocale: 'th-TH',
messages: returnMessagesFromPropertiesFile(thMessages),
},
{
name: 'Русский',
locale: 'ru',
contentfulLocale: 'ru-RU',
messages: returnMessagesFromPropertiesFile(ruMessages),
},
{
name: 'Português',
locale: 'pt-BR',
contentfulLocale: 'pt-BR',
messages: returnMessagesFromPropertiesFile(ptBRMessages),
},
{
name: 'Español',
locale: 'es',
contentfulLocale: 'es',
messages: returnMessagesFromPropertiesFile(esMessages),
},
{
name: 'Español',
locale: 'id',
contentfulLocale: 'id',
messages: returnMessagesFromPropertiesFile(idMessages),
},
];