Skip to content

Commit

Permalink
fix(formats): new_translation = "[]\n" for go-i18n-json
Browse files Browse the repository at this point in the history
The go-i18n-json v1 format uses an array as top level element (unlike
all other JSON formats).

I have manually checked, that the added `parse_file` line in the tests
would have caught this.

Discovered while working on #11133 / #11937.
  • Loading branch information
gzm0 authored and nijel committed Jul 15, 2024
1 parent 58909c3 commit f636679
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions weblate/formats/tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ class GoI18NV1JSONFormatTest(JSONFormatTest):
MASK = "go-i18n-json/*.json"
EXPECTED_PATH = "go-i18n-json/cs_CZ.json"
FIND_CONTEXT = "hello"
MATCH = "[]\n"
NEW_UNIT_MATCH = (
b'{\n "id": "key",\n "translation": "Source string"\n }\n'
)
Expand Down
1 change: 1 addition & 0 deletions weblate/formats/ttkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ class GoI18JSONFormat(JSONFormat):
format_id = "go-i18n-json"
loader = ("jsonl10n", "GoI18NJsonFile")
autoload: tuple[str, ...] = ()
new_translation = "[]\n"
supports_plural: bool = True


Expand Down

0 comments on commit f636679

Please sign in to comment.