Cover every supported language in ContentLanguage detection tests

Extend the homepage-language detection dataset to assert all 15 supported
languages resolve from their <html lang> subtag, and pin the primary-subtag
matching so a malformed tag ("english") no longer resolves via a two-letter
prefix.
This commit is contained in:
Paulo Castellano 2026-07-03 15:39:35 -03:00
parent 6797706921
commit c59adb4871
2 changed files with 20 additions and 1 deletions

View file

@ -100,13 +100,29 @@
expect($result->language)->toBe($expected);
})->with([
// Every supported language, detected from its primary subtag.
['en', 'en'],
['pt', 'pt-BR'],
['es', 'es'],
['fr', 'fr'],
['de', 'de'],
['it', 'it'],
['nl', 'nl'],
['pl', 'pl'],
['el', 'el'],
['ja', 'ja'],
['ko', 'ko'],
['zh', 'zh'],
['ru', 'ru'],
['tr', 'tr'],
['ar', 'ar'],
// Region/script subtags still resolve to the supported language.
['pt-PT', 'pt-BR'],
['en-US', 'en'],
['es-MX', 'es'],
['fr', 'fr'],
['ja-JP', 'ja'],
['zh-Hans', 'zh'],
// Unsupported languages stay null.
['sv', null],
]);

View file

@ -44,4 +44,7 @@
['sv', null],
['e', null],
['', null],
// A malformed tag is matched on its whole primary subtag, never a
// two-letter prefix — "english" must not resolve to English via "en".
['english', null],
]);