Server settings → Defaults: show each language's flag, as the language picker does #208
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Postulo/postulo#208
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Server settings → Defaults names languages in two places and shows no flag in either, while Settings → Language and time shows a flag beside every language (#52, #88, #119). The same list should look the same on both pages.
Where the languages appear without flags
src/postulo/templates/server/defaults.html{{ option.tag }}plus<span lang="…">{{ option.choice_label }}</span>. The rows come fromOfferedLanguagesForm(core/server_forms.py), whose choices are only(code, name)pairs fromlanguages.NATIVE_NAMES, so no country reaches the template.DefaultsForm.default_language): a plain<select>drawn bypartials/field.html, with choices fromaccounts.forms.language_choices.What already exists to reuse
{% flag country %}incore/templatetags/postulo.pydraws an SVG out ofstatic/flags/. It is decorative by default (alt="" aria-hidden="true"), 20×15, and draws nothing for an unknown or empty country.languages.flag_country(code)incore/languages.pygives the country (or ISO 3166-2 subdivision, e.g.ES-CT) for a language. It returns""on purpose for languages with no single home, e.g.ar,sw,ha. The row has to close up cleanly when that happens.LocaleForm.language_groups()/_language_option()inaccounts/forms.pyalready build rows withcode,name,country,stateandpercent.settings/locale.htmlrenders them as{% flag option.country %}between the input and thelangspan.Points to settle
OfferedLanguagesFormthat returns rows withcountry), or calllanguages.flag_country(option.data.value)through a template filter/tag. Put the flag outside thelangspan, as on the locale page.<select>: an<option>cannot hold an image. #119 turned the account picker into a<details>with radio rows for this reason, because a flag in the option text gets read aloud with the name. Options:<select>, which needsapp.jsto update it on change (the CSP forbids inline script, and without scripts it would show the saved value);partials/translation_state.html) should come along too, or only the flag.Checks when this is picked up
tests/test_offered_languages.py,tests/test_server_settings.py, andtests/test_flags.py, which covers the tag and the locale picker. Add: every offered-language row whose language has a country drawsdata-flag, a language without one draws no<img>, and the flag isaria-hidden.npm run build:cssif new classes appear (the flag's white-edge rule is already in the stylesheet, seetest_the_stylesheet_keeps_a_white_edged_flag_from_disappearing).