fix(i18n): drive customer "Preferred language" select from SUPPORTED_LANGUAGES (#510)

Audit follow-up to the Spanish-locale commit: `CustomerDetailPage` had
a hardcoded `<option>` list for the customer's preferred-language
selector — 5 entries (en/de/nl/pt/ru) that were missing both fr (an
existing gap) and es (the new one). Every other language selector in
the frontend (the navbar `LanguageSelector`, the `GeneralTab` default-
language dropdown, the `EmailConfigPage` per-language tabs) already
reads from the shared `SUPPORTED_LANGUAGES` constant, so adding es
there was enough for those. This one had drifted.

Now mapped from `SUPPORTED_LANGUAGES` so future locales only need to
touch one place.
This commit is contained in:
Paul Nothaft
2026-05-17 00:57:03 +02:00
parent 061712ebf1
commit 51890e1aa5
@@ -20,6 +20,7 @@ import {
import { format } from 'date-fns'; import { format } from 'date-fns';
import { Button, Card, Input, Loading } from '../../components/common'; import { Button, Card, Input, Loading } from '../../components/common';
import { SUPPORTED_LANGUAGES } from '../../components/common/LanguageSelector';
import { AssignedEventsDialog } from '../../components/admin/AssignedEventsDialog'; import { AssignedEventsDialog } from '../../components/admin/AssignedEventsDialog';
import { import {
customerAdminService, customerAdminService,
@@ -227,11 +228,12 @@ export const CustomerDetailPage: React.FC = () => {
onChange={setField('preferredLanguage')} onChange={setField('preferredLanguage')}
className="input" className="input"
> >
<option value="en">English</option> {/* Drive the option list from SUPPORTED_LANGUAGES so adding a
<option value="de">Deutsch</option> locale (#510 added es; fr was already missing here) only
<option value="nl">Nederlands</option> needs to touch LanguageSelector. */}
<option value="pt">Português</option> {SUPPORTED_LANGUAGES.map((lang) => (
<option value="ru">Русский</option> <option key={lang.code} value={lang.code}>{lang.name}</option>
))}
</select> </select>
</div> </div>
</div> </div>