Special case English translation fallback

We should not be listing this in LINGUAS as that gives the impression
that English has en explicit translation. Instead, it is a special case
that the code needs to be explicitly aware of.

This reverts 9a06058 in favour of a more robust fix.
This commit is contained in:
Pierre Ossman
2023-04-05 12:46:17 +02:00
parent 747603c0d5
commit a4453c9a26
3 changed files with 17 additions and 8 deletions
+10
View File
@@ -27,6 +27,16 @@ describe('Localization', function () {
l10n.setup(["es", "fr"]);
expect(l10n.language).to.equal('en');
});
it('should fall back to generic English for other English', function () {
window.navigator.languages = ["en-AU", "de"];
l10n.setup(["de", "fr", "en-GB"]);
expect(l10n.language).to.equal('en');
});
it('should prefer specific English over generic', function () {
window.navigator.languages = ["en-GB", "de"];
l10n.setup(["de", "en-AU", "en-GB"]);
expect(l10n.language).to.equal('en-GB');
});
it('should use the most preferred user language', function () {
window.navigator.languages = ["nl", "de", "fr"];
l10n.setup(["es", "fr", "de"]);