From 9ac7725dbe84f3fab9b191452471d8eaffd55048 Mon Sep 17 00:00:00 2001 From: Chris Swithinbank Date: Tue, 6 Aug 2024 11:32:48 +0200 Subject: [PATCH] Define well-known RTL locales before calling `getLocaleInfo()` for default locale (#2167) --- .changeset/odd-sheep-love.md | 5 +++++ packages/starlight/utils/i18n.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/odd-sheep-love.md diff --git a/.changeset/odd-sheep-love.md b/.changeset/odd-sheep-love.md new file mode 100644 index 0000000000..04a53315c8 --- /dev/null +++ b/.changeset/odd-sheep-love.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': patch +--- + +Fixes an issue detecting the built-in locale when running Starlight in a web container environment on Firefox diff --git a/packages/starlight/utils/i18n.ts b/packages/starlight/utils/i18n.ts index ce07b1cc4d..5ec6672225 100644 --- a/packages/starlight/utils/i18n.ts +++ b/packages/starlight/utils/i18n.ts @@ -2,9 +2,6 @@ import type { AstroConfig } from 'astro'; import { AstroError } from 'astro/errors'; import type { StarlightConfig } from './user-config'; -/** Informations about the built-in default locale used as a fallback when no locales are defined. */ -export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' }; - /** * A list of well-known right-to-left languages used as a fallback when determining the text * direction of a locale is not supported by the `Intl.Locale` API in the current environment. @@ -14,6 +11,9 @@ export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' }; */ const wellKnownRTL = ['ar', 'fa', 'he', 'prs', 'ps', 'syc', 'ug', 'ur']; +/** Informations about the built-in default locale used as a fallback when no locales are defined. */ +export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' }; + /** * Processes the Astro and Starlight i18n configurations to generate/update them accordingly: *