i18n: switch URL locale codes to xx-xx (Angular contract)

Angular's LocalizationService reads `Country = baseHref[1..3]` and
`Language = baseHref[4..6]` — both halves are the same 2-letter
language code (`/ru-ru/`, `/en-en/`, `/zh-zh/`, …), confirmed by
the spec fixtures using `/en-en/onlineboard/...`. The previous
shipping codes mixed in IETF region codes (`en-us`, `ja-jp`, `ko-kr`,
`zh-cn`) which do not match the customer's URL surface.

Renamed:
  en-us → en-en
  ja-jp → ja-ja
  ko-kr → ko-ko
  zh-cn → zh-zh

The `LANGUAGE_TO_LOCALE_CODE` table now mirrors Angular exactly.
Resolver/hreflang tests + layout 404 message updated.
This commit is contained in:
2026-04-19 18:39:51 +03:00
parent ce2ca4a689
commit 9acfeb4052
6 changed files with 28 additions and 23 deletions
+2 -2
View File
@@ -43,10 +43,10 @@ describe("buildHreflangSet", () => {
});
const en = result.find((entry) => entry.lang === "en");
expect(en?.href).toBe("https://www.aeroflot.ru/en-us/onlineboard");
expect(en?.href).toBe("https://www.aeroflot.ru/en-en/onlineboard");
const ja = result.find((entry) => entry.lang === "ja");
expect(ja?.href).toBe("https://www.aeroflot.ru/ja-jp/onlineboard");
expect(ja?.href).toBe("https://www.aeroflot.ru/ja-ja/onlineboard");
});
it("preserves paths with nested segments", () => {
+1 -1
View File
@@ -16,7 +16,7 @@ export interface HreflangEntry {
* Returns 9 language entries + 1 x-default entry (pointing to the
* default language). Hreflang attribute uses the short language code
* (`hreflang="en"`); the URL itself uses the BCP-47 locale code
* (`/en-us/...`) to match the customer's URL contract.
* (`/en-en/...`) to match the customer's URL contract.
*/
export function buildHreflangSet(args: {
canonicalOrigin: string;