File tree 4 files changed +526
-26
lines changed
4 files changed +526
-26
lines changed Original file line number Diff line number Diff line change
1
+ const { SUPPORTED_LOCALES } = require ( './' ) ;
2
+
3
+ module . exports = {
4
+ locales : SUPPORTED_LOCALES ,
5
+
6
+ keySeparator : false ,
7
+ namespaceSeparator : false ,
8
+
9
+ sort : true ,
10
+
11
+ output : 'locales/$LOCALE.json'
12
+ } ;
Original file line number Diff line number Diff line change 1
1
const i18next = require ( 'i18next' ) ;
2
2
3
+ const RESOURCES = {
4
+ en : {
5
+ translation : require ( '../locales/en.json' )
6
+ } ,
7
+ nl : {
8
+ translation : require ( '../locales/nl.json' )
9
+ }
10
+ } ;
11
+
12
+ const SUPPORTED_LOCALES = Object . keys ( RESOURCES ) ;
13
+
3
14
module . exports = ( lng = 'en' ) => {
4
15
const i18nextInstance = i18next . createInstance ( ) ;
5
16
i18nextInstance . init ( {
@@ -13,15 +24,10 @@ module.exports = (lng = 'en') => {
13
24
// do not load a fallback
14
25
fallbackLng : false ,
15
26
16
- resources : {
17
- en : {
18
- translation : require ( '../locales/en.json' )
19
- } ,
20
- nl : {
21
- translation : require ( '../locales/nl.json' )
22
- }
23
- }
27
+ resources : RESOURCES
24
28
} ) ;
25
29
26
30
return i18nextInstance ;
27
31
} ;
32
+
33
+ module . exports . SUPPORTED_LOCALES = SUPPORTED_LOCALES ;
Original file line number Diff line number Diff line change 7
7
"main" : " index.js" ,
8
8
"scripts" : {
9
9
"dev" : " echo \" Implement me!\" " ,
10
- "test:unit" : " NODE_ENV=testing c8 --all --check-coverage --100 --reporter text --reporter cobertura mocha './test/**/*.test.js'" ,
10
+ "test:unit" : " NODE_ENV=testing c8 --include index.js --include lib --check-coverage --100 --reporter text --reporter cobertura mocha './test/**/*.test.js'" ,
11
11
"test" : " yarn test:unit" ,
12
12
"lint:code" : " eslint *.js lib/ --ext .js --cache" ,
13
13
"lint" : " yarn lint:code && yarn lint:test" ,
14
- "lint:test" : " eslint -c test/.eslintrc.js test/ --ext .js --cache"
14
+ "lint:test" : " eslint -c test/.eslintrc.js test/ --ext .js --cache" ,
15
+ "translate:portal" : " i18next '../portal/src/**/*.{js,jsx}'"
15
16
},
16
17
"files" : [
17
18
" index.js" ,
20
21
],
21
22
"devDependencies" : {
22
23
"c8" : " 7.12.0" ,
24
+ "i18next-parser" : " 7.6.0" ,
23
25
"mocha" : " 10.2.0"
24
26
},
25
27
"dependencies" : {
You can’t perform that action at this time.
0 commit comments