Commit 2819a976 authored by Matija Obreza's avatar Matija Obreza
Browse files

i18n: sort modules before merging to translations.json

parent da2e0d0d
......@@ -2,14 +2,15 @@ const fg = require('fast-glob');
const _ = require('lodash');
const fs = require('fs');
const getPrefix = (path) => path.substring(path.indexOf('./src/') + './src/'.length, path.indexOf('/translations.json'));
fg([`./src/**/translations.json`, `./src/translations.json`])
.then((entries) => entries.sort((a, b) => getPrefix(a).localeCompare(getPrefix(b))))
.then((entries) => entries.map((path) => getTranslations(path)))
.then((content) => fs.writeFileSync(`locales/en/translations.json`, `{\n${content}}`));
const getTranslations = (path) => {
const prefix = path.substring(path.indexOf('./src/') + './src/'.length, path.indexOf('/translations.json'));
const prefix = getPrefix(path);
console.log('Loading translations of module', prefix);
const fileContent = fs.readFileSync(path, 'utf8');
......
......@@ -444,7 +444,7 @@
"public": {
"c": {
"instituteCard": {
"accessionsInGenesys": "Accessions in Genesys: {{count, numeric}}"
"accessionsInGenesys": "Accessions in Genesys: {{count, number}}"
}
},
"f": {
......
......@@ -2,7 +2,7 @@
"public": {
"c": {
"instituteCard": {
"accessionsInGenesys": "Accessions in Genesys: {{count, numeric}}"
"accessionsInGenesys": "Accessions in Genesys: {{count, number}}"
}
},
"f": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment