Server settings → Defaults: with nothing stored no language is ticked, and a partly translated language loses its region #322

Closed
opened 2026-09-29 20:25:40 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 while building #312. Both bugs were already there before that change.

1. With nothing stored, no language is ticked

With the setting empty (a new instance, or one that never saved Defaults), Languages this instance offers shows every box unticked, although the page says every language is offered. The form's initial value comes from the saved record, an empty list, and that overrides the field's default of "all".

Saving the page as shown is where this could go wrong: the stored value would then disagree with what the page claimed.

Fix: when the stored list is empty, the form starts with every language ticked. A test renders the page on a fresh instance and finds every box ticked, and a second test saves the page unchanged and finds the offer unchanged.

2. A partly translated language loses its region in the list

LocaleForm._language_option cuts a language's name at the first " (" to drop the percentage it appends. A name that has a region in brackets loses the region as well: "français (France)" is shown as "français", next to "français (Canada)" if that is ever added.

Fix: remove only the part the code appended (keep it apart from the name rather than cutting at a bracket). A test uses a partly translated regional language.

Found on 2026-09-29 while building #312. Both bugs were already there before that change. ## 1. With nothing stored, no language is ticked With the setting empty (a new instance, or one that never saved *Defaults*), *Languages this instance offers* shows every box unticked, although the page says every language is offered. The form's initial value comes from the saved record, an empty list, and that overrides the field's default of "all". Saving the page as shown is where this could go wrong: the stored value would then disagree with what the page claimed. **Fix:** when the stored list is empty, the form starts with every language ticked. A test renders the page on a fresh instance and finds every box ticked, and a second test saves the page unchanged and finds the offer unchanged. ## 2. A partly translated language loses its region in the list `LocaleForm._language_option` cuts a language's name at the first " (" to drop the percentage it appends. A name that has a region in brackets loses the region as well: "français (France)" is shown as "français", next to "français (Canada)" if that is ever added. **Fix:** remove only the part the code appended (keep it apart from the name rather than cutting at a bracket). A test uses a partly translated regional language.
tiagoagueda added this to the 0.5.0 milestone 2026-09-29 20:25:40 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo#322
No description provided.