From 86d85c4ac48aadd79e040c7818fbd13525cf9aae Mon Sep 17 00:00:00 2001 From: ComicIvans Date: Thu, 13 Nov 2025 21:34:47 +0100 Subject: [PATCH 1/5] feat(i18n): add Spanish (es) locale --- layer/i18n/locales/es.json | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 layer/i18n/locales/es.json diff --git a/layer/i18n/locales/es.json b/layer/i18n/locales/es.json new file mode 100644 index 000000000..74cc279a8 --- /dev/null +++ b/layer/i18n/locales/es.json @@ -0,0 +1,22 @@ +{ + "common": { + "or": "o", + "error": { + "title": "Página no encontrada", + "description": "Lo sentimos, no se pudo encontrar esta página." + } + }, + "docs": { + "copy": { + "page": "Copiar página", + "link": "Copiar página en Markdown", + "view": "Ver como Markdown", + "gpt": "Abrir en ChatGPT", + "claude": "Abrir en Claude" + }, + "links": "Comunidad", + "toc": "En esta página", + "report": "Reportar un problema", + "edit": "Editar esta página" + } +} From 07092b754788438b0ada1d73064b10a94049e9be Mon Sep 17 00:00:00 2001 From: ComicIvans Date: Fri, 14 Nov 2025 00:39:26 +0100 Subject: [PATCH 2/5] First try to enable changing single locale --- layer/app/app.config.ts | 1 + layer/app/app.vue | 8 ++++--- layer/app/components/LanguageSelect.vue | 1 + layer/app/composables/useDocusI18n.ts | 30 +++++++++++++++++++++++-- layer/app/types/index.d.ts | 1 + layer/nuxt.schema.ts | 7 ++++++ 6 files changed, 43 insertions(+), 5 deletions(-) diff --git a/layer/app/app.config.ts b/layer/app/app.config.ts index e81b4a401..ebc3e98da 100644 --- a/layer/app/app.config.ts +++ b/layer/app/app.config.ts @@ -1,4 +1,5 @@ export default defineAppConfig({ + locale: 'en', ui: { colors: { primary: 'emerald', diff --git a/layer/app/app.vue b/layer/app/app.vue index a1003cc2d..251b2fe91 100644 --- a/layer/app/app.vue +++ b/layer/app/app.vue @@ -6,8 +6,10 @@ const { seo } = useAppConfig() const site = useSiteConfig() const { locale, locales, isEnabled, switchLocalePath } = useDocusI18n() -const lang = computed(() => nuxtUiLocales[locale.value as keyof typeof nuxtUiLocales]?.code || 'en') -const dir = computed(() => nuxtUiLocales[locale.value as keyof typeof nuxtUiLocales]?.dir || 'ltr') +const matchedUiLocale = computed(() => nuxtUiLocales[locale.value as keyof typeof nuxtUiLocales]) +const uiLocale = computed(() => matchedUiLocale.value || nuxtUiLocales.en) +const lang = computed(() => matchedUiLocale.value.code || 'en') +const dir = computed(() => matchedUiLocale.value?.dir || 'ltr') const collectionName = computed(() => isEnabled.value ? `docs_${locale.value}` : 'docs') useHead({ @@ -58,7 +60,7 @@ provide('navigation', navigation)