Merge pull request #3307 from overleaf/jpa-i18n-fixes

[misc] i18n fixes

GitOrigin-RevId: 862acff0a96b3717f1410327d1dcc469268f5e30
This commit is contained in:
Jakob Ackermann 2020-10-21 10:35:32 +02:00 committed by Copybot
parent cee714ca01
commit 01712f1229
2 changed files with 12 additions and 2 deletions

View file

@ -1,8 +1,11 @@
{
"other_output_files": "Other output files",
"toggle_output_files_list": "Toggle output files list",
"n_warnings": "__count__ warning",
"n_warnings_plural": "__count__ warnings",
"n_errors": "__count__ error",
"n_errors_plural": "__count__ errors",
"toggle_compile_options_menu": "Toggle compile options menu",
"view_pdf": "View PDF",
"your_project_has_errors": "Your project has errors",
"view_warnings": "View warnings",
@ -1105,6 +1108,7 @@
"remove_collaborator": "Remove collaborator",
"add_to_folders": "Add to folders",
"download_zip_file": "Download .zip File",
"download_file": "Download <0>__type__</0> file",
"price": "Price",
"close": "Close",
"keybindings": "Keybindings",

View file

@ -19,6 +19,13 @@ async function run() {
const json = JSON.parse(content)
for (const [code, lang] of Object.entries(json)) {
if (code === 'en-GB') {
// OneSky does not have read-after-write consistency.
// Skip the dump of English locales, which may not include locales
// that were just uploaded.
continue
}
for (let [key, value] of Object.entries(lang.translation)) {
// Handle multi-line strings as arrays by joining on newline
if (Array.isArray(value)) {
@ -27,9 +34,8 @@ async function run() {
lang.translation[key] = sanitize(value)
}
const outputLngCode = code === 'en-GB' ? 'en' : code
await fs.writeFile(
`${__dirname}/../../locales/${outputLngCode}.json`,
`${__dirname}/../../locales/${code}.json`,
JSON.stringify(lang.translation, null, 2) + '\n'
)
}