mirror of
https://github.com/element-hq/element-web
synced 2024-11-22 01:05:42 +03:00
Update weblateToCounterpart to be more resilient (#22247)
* Update i18n check CI to ignore RiotTranslateBot * Update `weblateToCounterpart` to be more resilient
This commit is contained in:
parent
aca0346f4e
commit
b3ef2c179a
2 changed files with 12 additions and 3 deletions
5
.github/workflows/static_analysis.yaml
vendored
5
.github/workflows/static_analysis.yaml
vendored
|
@ -44,7 +44,10 @@ jobs:
|
|||
files_ignore: |
|
||||
src/i18n/strings/en_EN.json
|
||||
- name: "Assert only en_EN was modified"
|
||||
if: github.event_name == 'pull_request' && steps.changed_files.outputs.any_modified == 'true'
|
||||
if: |
|
||||
github.event_name == 'pull_request' &&
|
||||
github.actor != 'RiotTranslateBot' &&
|
||||
steps.changed_files.outputs.any_modified == 'true'
|
||||
run: |
|
||||
echo "You can only modify en_EN.json, do not touch any of the other i18n files as Weblate will be confused"
|
||||
exit 1
|
||||
|
|
|
@ -232,8 +232,14 @@ function weblateToCounterpart(inTrs) {
|
|||
if (keyParts.length === 2) {
|
||||
let obj = outTrs[keyParts[0]];
|
||||
if (obj === undefined) {
|
||||
obj = {};
|
||||
outTrs[keyParts[0]] = obj;
|
||||
obj = outTrs[keyParts[0]] = {};
|
||||
} else if (typeof obj === "string") {
|
||||
// This is a transitional edge case if a string went from singular to pluralised and both still remain
|
||||
// in the translation json file. Use the singular translation as `other` and merge pluralisation atop.
|
||||
obj = outTrs[keyParts[0]] = {
|
||||
"other": inTrs[key],
|
||||
};
|
||||
console.warn("Found entry in i18n file in both singular and pluralised form", keyParts[0]);
|
||||
}
|
||||
obj[keyParts[1]] = inTrs[key];
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue