Skip to content

Commit 3b95b64

Browse files
committed
fix(i18n): match source locale variants in isSourceLocale check
1 parent 8f8360b commit 3b95b64

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

app/composables/useI18nStatus.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ export function useI18nStatus() {
4343
})
4444

4545
/**
46-
* Whether the current locale is the source locale (English)
46+
* Whether the current locale is the source locale (English) or a variant of it.
47+
* The source locale is 'en' (base), but app-facing locale codes are 'en-US', 'en-GB', etc.
48+
* We check if the current locale starts with the source locale code to handle variants.
4749
*/
4850
const isSourceLocale = computed(() => {
49-
return locale.value === (status.value?.sourceLocale.lang ?? 'en-US')
51+
const sourceLang = status.value?.sourceLocale.lang ?? 'en'
52+
return locale.value === sourceLang || locale.value.startsWith(`${sourceLang}-`)
5053
})
5154

5255
/**

0 commit comments

Comments
 (0)