Translation building script modification, for Weblate integration:
When pluggin Weblate to the repo, its first commits replaced `false` by `true` in JSON files. See PR #184. So i modified the build-language.js script to remove all translations that are not strings. Should do the trick.
This commit is contained in:
parent
8f66ea4032
commit
dd1662c3cf
@ -67,6 +67,10 @@ class BuildLanguages {
|
|||||||
if (k in translationsStrings[l]) {
|
if (k in translationsStrings[l]) {
|
||||||
throw new Error(`Duplicate translation for key ${k} in lang ${l}.`)
|
throw new Error(`Duplicate translation for key ${k} in lang ${l}.`)
|
||||||
}
|
}
|
||||||
|
if ((typeof v) !== 'string') {
|
||||||
|
// ignoring untranslated strings.
|
||||||
|
continue
|
||||||
|
}
|
||||||
translationsStrings[l][k] = v
|
translationsStrings[l][k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,6 +94,10 @@ class BuildLanguages {
|
|||||||
if (!(k in reference)) {
|
if (!(k in reference)) {
|
||||||
throw new Error(`File ${filePath} contains unknown keys. Key=${k}.`)
|
throw new Error(`File ${filePath} contains unknown keys. Key=${k}.`)
|
||||||
}
|
}
|
||||||
|
if ((typeof o[k]) !== 'string') {
|
||||||
|
// ignoring untranslated strings.
|
||||||
|
continue
|
||||||
|
}
|
||||||
const newKey = reference[k]
|
const newKey = reference[k]
|
||||||
this.translationsStrings[l][newKey] = o[k]
|
this.translationsStrings[l][newKey] = o[k]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user