diff --git a/src/module.ts b/src/module.ts index ffa97cb7..b39f8e2b 100644 --- a/src/module.ts +++ b/src/module.ts @@ -8,6 +8,7 @@ import { createResolver, defineNuxtModule, extendPages, + addComponentsDir, } from '@nuxt/kit' import type { HookResult } from '@nuxt/schema' import { setupDevToolsUI } from './devtools' @@ -69,7 +70,7 @@ export default defineNuxtModule({ return (forms.length > 2 ? forms[2].trim() : forms[forms.length - 1].trim()).replace('{count}', count.toString()) }`, }, - setup: function (options, nuxt) { + setup: async function (options, nuxt) { const resolver = createResolver(import.meta.url) nuxt.options.runtimeConfig.public.i18nConfig = { @@ -123,6 +124,12 @@ export default defineNuxtModule({ handler: resolver.resolve('./runtime/server/middleware/i18n-loader'), }) + await addComponentsDir({ + path: resolver.resolve('./runtime/components'), + pathPrefix: false, + extensions: ['vue'], + }) + const localeRegex = options.locales! .filter(locale => locale.code !== options.defaultLocale || options.includeDefaultLocaleRoute) // Фильтрация локалей, исключая дефолтную .map(locale => locale.code) // Извлечение поля code из каждого объекта Locale diff --git a/src/runtime/components/i18n-t.vue b/src/runtime/components/i18n-t.vue new file mode 100644 index 00000000..a0a8f3c4 --- /dev/null +++ b/src/runtime/components/i18n-t.vue @@ -0,0 +1,61 @@ + + +