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
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}}`));
.then((entries) => {
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 prefix = getPrefix(path);
console.log('Loading translations of module', prefix);
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);
}
};
{
"public": {
"p": {
"welcome": {
......@@ -171,7 +170,7 @@
"name": "Name",
"shortName": "Short name"
},
"partners" : {
"partners": {
"partners": "Data providers",
"acronym": "Acronym",
"title": "Title",
......@@ -338,34 +337,12 @@
"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": {
"inReview": "In review",
"inProgress": "Draft",
"published": "Published"
}
,"accessions": {
},
"accessions": {
"public": {
"c": {
"accessionCard": {
......@@ -446,7 +423,6 @@
"stopPick": "Cancel",
"noClimateData": "No climate data available for selected location"
}
}
},
"tab": {
......@@ -545,7 +521,6 @@
"storageType": "Type of germplasm storage",
"lastModifiedDate": "Last updated",
"createdDate": "First uploaded",
"alias": {
"OTHERNUMB": "Other identifier",
"ACCENAME": "Accession name",
......@@ -553,23 +528,23 @@
"COLLNUMB": "Collecting number"
},
"available": {
"0": "Not available for distribution",
"1": "Available for distribution",
"true": "Available for distribution",
"false": "Not available for distribution",
"1": "Available for distribution",
"0": "Not available for distribution",
"null": "Availability not provided"
},
"sgsv": {
"true": "Backed up in SGSV",
"false": "Not in SGSV",
"0": "Not in SGSV",
"1": "Backed up in SGSV",
"0": "Not in SGSV"
"true": "Backed up in SGSV",
"false": "Not in SGSV"
},
"mlsStatus": {
"0": "Not declared in the Multi-lateral system of ITPGRFA",
"1": "Accession is part of the Multi-lateral system of ITPGRFA",
"true": "Accession is part of the Multi-lateral system of ITPGRFA",
"false": "Not declared in the Multi-lateral system of ITPGRFA",
"1": "Accession is part of the Multi-lateral system of ITPGRFA",
"0": "Not declared in the Multi-lateral system of ITPGRFA",
"null": "Status not provided"
},
"coll": {
......@@ -588,7 +563,6 @@
"datum": "Geodetic datum",
"method": "Georeferencing method",
"elevation": "Elevation of collecting site",
"climate": {
"bio1": "Annual mean temperature [°C]",
"bio2": "Mean diurnal range (mean of monthly (max temp - min temp))",
......@@ -692,23 +666,23 @@
"COLLNUMB": "Collecting number"
},
"available": {
"0": "Not available for distribution",
"1": "Available for distribution",
"true": "Available for distribution",
"false": "Not available for distribution",
"1": "Available for distribution",
"0": "Not available for distribution",
"null": "Availability not provided"
},
"sgsv": {
"true": "Backed up in SGSV",
"false": "Not in SGSV",
"0": "Not in SGSV",
"1": "Backed up in SGSV",
"0": "Not in SGSV"
"true": "Backed up in SGSV",
"false": "Not in SGSV"
},
"mlsStatus": {
"0": "Not declared in the Multi-lateral system of ITPGRFA",
"1": "Accession is part of the Multi-lateral system of ITPGRFA",
"true": "Accession is part of the Multi-lateral system of ITPGRFA",
"false": "Not declared in the Multi-lateral system of ITPGRFA",
"1": "Accession is part of the Multi-lateral system of ITPGRFA",
"0": "Not declared in the Multi-lateral system of ITPGRFA",
"null": "Status not provided"
},
"coll": {
......@@ -806,8 +780,8 @@
"storage": "Type of Germplasm storage"
}
}
}
,"cms": {
},
"cms": {
"admin": {
"c": {
"articleForm": {
......@@ -897,9 +871,8 @@
"lastModifiedDateAsc": "Last modified date (old to new)",
"lastModifiedDateDesc": "Last modified date (new to old)"
}
}
,"crop": {
},
"crop": {
"public": {
"c": {
"cropCard": {
......@@ -954,8 +927,8 @@
"cropDetails": "{{cropName,string}} details",
"cropList": "List of crops"
}
}
,"datasets": {
},
"datasets": {
"common": {
"delete": "Deleting the dataset will remove all related data.",
"modelName": "Dataset",
......@@ -1187,9 +1160,8 @@
"startDate": "Experiment start date",
"endDate": "Experiment end date"
}
}
,"descriptorlists": {
},
"descriptorlists": {
"common": {
"modelName": "Descriptor list",
"modelName_plural": "Descriptor lists",
......@@ -1252,7 +1224,6 @@
"keywordSearch": "Keyword search",
"rice": "mardi rice",
"originalPublisher": "Original publisher"
},
"p": {
"display": {
......@@ -1290,8 +1261,8 @@
"createDescriptorlist": "Create descriptor list"
}
}
}
,"descriptors": {
},
"descriptors": {
"common": {
"modelName": "Descriptor",
"modelName_plural": "Descriptors",
......@@ -1508,8 +1479,8 @@
"columnName": "Column name",
"owner": "Maintainer"
}
}
,"geo": {
},
"geo": {
"public": {
"p": {
"countryList": {
......@@ -1544,9 +1515,8 @@
"country": "Country",
"menu": "ISO-3166 codes"
}
}
,"institutes": {
},
"institutes": {
"public": {
"c": {
"instituteCard": {
......@@ -1606,7 +1576,7 @@
"materialRequests": "Material requests",
"allowMaterialRequests": "Allow material requests"
}
}
}
},
"sort": {
"instituteCode": "Institute code"
......@@ -1622,9 +1592,8 @@
"accessionsInGenesys": "Accessions in Genesys",
"instDetails": "{{instCode,string}} details"
}
}
,"kpi": {
},
"kpi": {
"admin": {
"c": {
"dimensionForm": {
......@@ -1657,7 +1626,7 @@
}
},
"execution": {
"type":{
"type": {
"COUNT": "Count",
"AVERAGE": "Average",
"SUM": "Sum"
......@@ -1763,8 +1732,8 @@
"showRun": "Show",
"executionRunsLoaded": "Execution runs loaded successfully"
}
}
,"list": {
},
"list": {
"public": {
"p": {
"browse": {
......@@ -1781,8 +1750,8 @@
"common": {
"menu": "My List"
}
}
,"partners": {
},
"partners": {
"admin": {
"c": {
"form": {
......@@ -1847,8 +1816,8 @@
}
}
}
}
,"repository": {
},
"repository": {
"admin": {
"p": {
"editFile": {
......@@ -1930,9 +1899,8 @@
}
}
}
}
,"requests": {
},
"requests": {
"public": {
"p": {
"stepper": {
......@@ -2006,8 +1974,8 @@
"lastModifiedDateAsc": "Last modified date (old to new)",
"lastModifiedDateDesc": "Last modified date (new to old)"
}
}
,"subsets": {
},
"subsets": {
"public": {
"c": {
"subsetCard": {
......@@ -2150,9 +2118,8 @@
}
}
}
}
,"user": {
},
"user": {
"public": {
"c": {
"loginForm": {
......@@ -2385,8 +2352,8 @@
"lastLoginAsc": "Last login (old to new)",
"lastLoginDesc": "Last login (new to old)"
}
}
,"vocabulary": {
},
"vocabulary": {
"common": {
"modelName": "Vocabulary",
"modelName_plural": "Vocabularies",
......@@ -2438,5 +2405,5 @@
"maintainer": "Maintainer",
"URL": "URL"
}
}
}
}
\ No newline at end of file
......@@ -337,28 +337,6 @@
"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": {
"inReview": "In review",
"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