Closed jhonatan-lopes closed 11 months ago
Patch coverage: 100.00%
and no project coverage change.
Comparison is base (
e2de395
) 93.27% compared to head (dcf744e
) 93.27%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The problem
On the "Translations" report, the current way to filter by locales is to type the language code in the field exactly as it was defined by the developers. This causes some issues.
First, we could have some editors/admins that might just want a quick reference into translations and might not experts in the field. Hence, it is not fair to expect them to know the language codes for all installed languages. For instance, although ubiquitous, one might not know that "de" is the language code for the German language.
The second problem is more subtle and more difficult to debug when it happens. If a project defines their
WAGTAIL_CONTENT_LANGUAGES
asfor example, the field as it current stands will only recognise "pt-BR" as the "Portuguese (Brazil)" language, but not "pt-br".
From the ITEF wiki:
So that the "correct-er" form would be "pt-BR", although if subtags are supposed to not be case-senstive then both cases must filter properly (which is not the currently behaviour).
The solution
This PR leverages the language codes defined in
WAGTAIL_CONTENT_LANGUAGES
to provide chooser fields for the locales instead of relying on having to type the proper language code. This abstracts the language code information from editors/admins with the bonus of displaying language names localized to their Wagtail admin choice.An "All" option is defined to display translations in all locales.
Screenshots:
Using the provided test app with: