web, locale: Normalize legacy locale file names (#24024)

* web/xliff: remove legacy Transifex-named locale files

The old Transifex config named locale files with underscores
(cs_CZ.xlf, pt_BR.xlf, ...) alongside the hyphenated BCP-47 form the
current lit-localize pipeline actually reads. That config was fixed
months ago, so the underscore files are either stale duplicates of a
current kebab-case sibling or orphaned contributions for locales the
project never enabled.

Deleted 11 legacy files that already have a kebab-case equivalent in
web/xliff/. Kebab wins even where the two diverged, so 2,220 legacy-only
<trans-unit> targets get dropped along the way (fr_FR carried the bulk
at 954; the rest of the languages contribute the remaining 1,266).

Renamed 3 legacy files with no kebab counterpart and added their locale
codes to web/lit-localize.json targetLocales:

- ar_AA.xlf -> ar.xlf (AA was a bogus private-use region; landed on
  the plain language code).
- bg_BG.xlf -> bg-BG.xlf.
- no_NO.xlf -> nb-NO.xlf (no is the Norwegian macrolanguage; the
  translation is Bokmal, so nb is the correct language subtag).

Each renamed file also has its internal target-language attribute
updated to match its new locale code, so lit-localize keeps
recognising the existing translations instead of treating everything
as absent.

Wired the new locales into LocaleLoaderRecord in
web/src/common/ui/locale/definitions.ts so the runtime can import the
emitted modules; lit-localize regenerates web/src/locale-codes.ts to
match. locale/ (Django gettext) stays exactly as it was.

Verified with: cd web && npm run build-locales && npm run precommit.

Co-Authored-By: Agent (authentik-m-remove-legacy-intended-nominal-mahogany) <279763771+playpen-agent@users.noreply.github.com>

* locale: sync Django language codes to lit-localize (ar_AA to ar, no_NO to nb_NO)

Mirror the two locale-code changes just landed on the web/xliff side
into the Django gettext tree, in Django's ll_CC underscore form:

- locale/ar_AA -> locale/ar (drop the bogus AA private-use region;
  matches web ar).
- locale/no_NO -> locale/nb_NO (Norwegian macrolanguage to Bokmal,
  which is the writing system the contributed translation uses;
  matches web nb-NO).

bg_BG is left alone (already equals the underscore form of the web
bg-BG), and every other Django locale directory - including zh-Hans
and zh-Hant - stays exactly as it was.

Both catalogs also had their in-file Language header updated to match
the new directory (Language: ar_AA -> ar, Language: no_NO -> nb_NO)
and the .mo binaries were recompiled via manage.py compilemessages so
runtime lookups get the correct language metadata.

No functional LANGUAGES / LANGUAGE_CODE settings referenced the old
codes: only historical Transifex team URLs in the .po Language-Team
headers and past release-notes lines mention them, and those are
metadata / audit trail rather than config.

Verified: to_locale('nb-no') -> 'nb_NO', to_locale('ar') -> 'ar', and
gettext.translation loads locale/ar/LC_MESSAGES/django.mo (1,122
entries, language=ar) and locale/nb_NO/LC_MESSAGES/django.mo (1,116
entries, language=nb_NO).

Co-Authored-By: Agent (authentik-m-remove-legacy-intended-nominal-mahogany) <279763771+playpen-agent@users.noreply.github.com>

---------

Co-authored-by: Agent (authentik-m-remove-legacy-intended-nominal-mahogany) <279763771+playpen-agent@users.noreply.github.com>
This commit is contained in:
Teffen Ellis
2026-07-15 17:42:27 +02:00
committed by GitHub
parent ffa7c77f62
commit 1dc509dcac
21 changed files with 16 additions and 121617 deletions

View File

@@ -19,7 +19,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ar_AA\n"
"Language: ar\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#: authentik/admin/files/api.py

View File

@@ -19,7 +19,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: no_NO\n"
"Language: nb_NO\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: authentik/admin/files/api.py

View File

@@ -2,6 +2,8 @@
"$schema": "https://raw.githubusercontent.com/lit/lit/main/packages/localize-tools/config.schema.json",
"sourceLocale": "en",
"targetLocales": [
"ar",
"bg-BG",
"cs-CZ",
"de-DE",
"en",
@@ -12,6 +14,7 @@
"it-IT",
"ja-JP",
"ko-KR",
"nb-NO",
"nl-NL",
"pl-PL",
"pt-BR",

View File

@@ -33,6 +33,8 @@ const sourceTargetModule: LocaleModule = {
export const LocaleLoaderRecord: Record<TargetLanguageTag, () => Promise<LocaleModule>> = {
[SourceLanguageTag]: () => Promise.resolve(sourceTargetModule),
[PseudoLanguageTag]: () => import("#locales/en-XA"),
"ar": () => import("#locales/ar"),
"bg-BG": () => import("#locales/bg-BG"),
"cs-CZ": () => import("#locales/cs-CZ"),
"de-DE": () => import("#locales/de-DE"),
"es-ES": () => import("#locales/es-ES"),
@@ -41,6 +43,7 @@ export const LocaleLoaderRecord: Record<TargetLanguageTag, () => Promise<LocaleM
"it-IT": () => import("#locales/it-IT"),
"ja-JP": () => import("#locales/ja-JP"),
"ko-KR": () => import("#locales/ko-KR"),
"nb-NO": () => import("#locales/nb-NO"),
"nl-NL": () => import("#locales/nl-NL"),
"pl-PL": () => import("#locales/pl-PL"),
"pt-BR": () => import("#locales/pt-BR"),

View File

@@ -11,6 +11,8 @@ export const sourceLocale = `en`;
* lexicographically.
*/
export const targetLocales = [
`ar`,
`bg-BG`,
`cs-CZ`,
`de-DE`,
`en-XA`,
@@ -20,6 +22,7 @@ export const targetLocales = [
`it-IT`,
`ja-JP`,
`ko-KR`,
`nb-NO`,
`nl-NL`,
`pl-PL`,
`pt-BR`,
@@ -33,6 +36,8 @@ export const targetLocales = [
* All valid project locale codes. Sorted lexicographically.
*/
export const allLocales = [
`ar`,
`bg-BG`,
`cs-CZ`,
`de-DE`,
`en`,
@@ -43,6 +48,7 @@ export const allLocales = [
`it-IT`,
`ja-JP`,
`ko-KR`,
`nb-NO`,
`nl-NL`,
`pl-PL`,
`pt-BR`,

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" ?><xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file target-language="ar-AA" source-language="en" original="lit-localize-inputs" datatype="plaintext">
<file target-language="ar" source-language="en" original="lit-localize-inputs" datatype="plaintext">
<body>
<!-- #region Locales -->
<trans-unit id="en">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" ?><xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file target-language="no-NO" source-language="en" original="lit-localize-inputs" datatype="plaintext">
<file target-language="nb-NO" source-language="en" original="lit-localize-inputs" datatype="plaintext">
<body>
<!-- #region Locales -->
<trans-unit id="en">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff