Commit 3b21c4a8 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: Incorrect location for "datasets.common" i18n key

parent 33d24773
...@@ -6,13 +6,38 @@ const getPrefix = (path) => path.substring(path.indexOf('./src/') + './src/'.len ...@@ -6,13 +6,38 @@ const getPrefix = (path) => path.substring(path.indexOf('./src/') + './src/'.len
fg([`./src/**/translations.json`, `./src/translations.json`]) fg([`./src/**/translations.json`, `./src/translations.json`])
.then((entries) => entries.sort((a, b) => getPrefix(a).localeCompare(getPrefix(b)))) .then((entries) => entries.sort((a, b) => getPrefix(a).localeCompare(getPrefix(b))))
.then((entries) => entries.map((path) => getTranslations(path))) .then((entries) => {
.then((content) => fs.writeFileSync(`locales/en/translations.json`, `{\n${content}}`)); let result = {};
entries.forEach((path) => {
result = { ...result, ...getTranslations(path) };
});
return result;
})
.then((content) => fs.writeFileSync(`locales/en/translations.json`, JSON.stringify(content, null, 2)))
.then(() => {
const content = fs.readFileSync(`locales/en/translations.json`);
JSON.parse(content);
}).catch((error) => {
console.log('Error reading resulting locales/en/translations.json', error);
process.exit(-1);
});
const getTranslations = (path) => { const getTranslations = (path) => {
const prefix = getPrefix(path); const prefix = getPrefix(path);
console.log('Loading translations of module', prefix); console.log('Loading translations of module', prefix);
const fileContent = fs.readFileSync(path, 'utf8'); const fileContent = fs.readFileSync(path, 'utf8');
try {
const i18n = JSON.parse(fileContent);
return prefix !== '/' ? _(`"${prefix}": ${fileContent}\n`).value() : fileContent.substr(1, fileContent.length - 2); if (prefix === '/') {
return i18n;
} else {
const moduleI18n = {};
moduleI18n[prefix] = i18n;
return moduleI18n;
}
} catch (error) {
console.log(`Invalid JSON in ${path}`, error);
process.exit(-1);
}
}; };
This diff is collapsed.
...@@ -337,28 +337,6 @@ ...@@ -337,28 +337,6 @@
"warningMessage": "Accession data cannot be exported. There are more than {{value, number}} entries." "warningMessage": "Accession data cannot be exported. There are more than {{value, number}} entries."
} }
}, },
"datasets": {
"common": {
"modelName": "Dataset",
"modelName_plural": "Datasets",
"stats": "C&E Dataset",
"stats_plural": "C&E Datasets",
"creator": {
"role": {
"MANAGER": "Data manager",
"COLLECTOR": "Data collector",
"DIGITIZER": "Data digitizer",
"CURATOR": "Data curator"
},
"roledesc": {
"MANAGER": "Responsible of the planning and execution of the germplasm characterization and evaluation activity which resulted in the dataset. Oversees the collection and management of characterization and evaluation data, and has final sign-off on publication.",
"COLLECTOR": "Records germplasm characterization or evaluation data in the field.",
"DIGITIZER": "Digitizes data.",
"CURATOR": "Organizes and validates data and metadata in correct format, ensures quality of both."
}
}
}
},
"status": { "status": {
"inReview": "In review", "inReview": "In review",
"inProgress": "Draft", "inProgress": "Draft",
......
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