mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-04-26 13:40:20 +03:00
feat(build): teach lint-locale-usage about trPluralString (#7425)
This requires using the more complicated parsing from localestore.go In order to avoid future code drift and code duplication, localestore.go was refactored to call IterateMessagesContent instead of essentially duplicating the code of RecursivelyAddTranslationsFromJSON with small adjustments. locale/utils.go was moved to translation/localeiter/utils.go in order to avoid spreading translation-related routines among completely different places. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7425 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Ellen Emilia Anna Zscheile <fogti+devel@ytrizja.de> Co-committed-by: Ellen Emilia Anna Zscheile <fogti+devel@ytrizja.de>
This commit is contained in:
parent
bd9366e7fc
commit
15a2338ff2
6 changed files with 73 additions and 66 deletions
|
@ -91,4 +91,16 @@ func TestNextLocalizationPolicy(t *testing.T) {
|
|||
"settings.hidden_comment_types_description": "\"<not-an-allowed-key> <label>\""
|
||||
}`)))
|
||||
})
|
||||
|
||||
t.Run("Plural form", func(t *testing.T) {
|
||||
assert.Equal(t, []string{"repo.pulls.title_desc: key = \x1b[31m<a href=\"https://example.com\">\x1b[0m"}, checkLocaleNextContent([]byte(`{"repo.pulls.title_desc": {
|
||||
"few": "key = <a href=\"%s\">",
|
||||
"other": "key = <a href=\"https://example.com\">"
|
||||
}}`)))
|
||||
|
||||
assert.Equal(t, []string{"repo.pulls.title_desc.few: key = \x1b[31m<a href=\"https://example.com\">\x1b[0m"}, checkLocaleNextContent([]byte(`{"repo.pulls.title_desc": {
|
||||
"few": "key = <a href=\"https://example.com\">",
|
||||
"other": "key = <a href=\"%s\">"
|
||||
}}`)))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue