diff --git a/stubs/config.stub b/stubs/config.stub index 6f086ff..5ae47a5 100644 --- a/stubs/config.stub +++ b/stubs/config.stub @@ -5,22 +5,22 @@ import { defineConfig } from '@adonisjs/i18n' import app from '@adonisjs/core/services/app' export default defineConfig({ - translationsFormat: 'icu', defaultLocale: 'en', + formatter: 'icu', - loaders: { - /** - * The fs loader will read translations from the - * "resources/lang" directory. - * - * Each subdirectory represents a locale. For example: - * - "resources/lang/en" - * - "resources/lang/fr" - * - "resources/lang/it" - */ - fs: { - enabled: true, + loaders: [ + { + /** + * The fs loader will read translations from the + * "resources/lang" directory. + * + * Each subdirectory represents a locale. For example: + * - "resources/lang/en" + * - "resources/lang/fr" + * - "resources/lang/it" + */ + driver: 'fs', location: app.languageFilesPath(), - }, - }, + } + ], }) diff --git a/stubs/detect_user_locale.stub b/stubs/detect_user_locale.stub index 1e988fa..826fd16 100644 --- a/stubs/detect_user_locale.stub +++ b/stubs/detect_user_locale.stub @@ -3,8 +3,8 @@ --- to: {{ app.middlewarePath(entity.path, middlewareFileName) }} --- -import type { I18n } from '@adonisjs/i18n' -import i18n from '@adonisjs/i18n/services/main' +import { I18n } from '@adonisjs/i18n' +import i18nManager from '@adonisjs/i18n/services/main' import type { NextFn } from '@adonisjs/core/types/http' import { type HttpContext, RequestValidator } from '@adonisjs/core/http' @@ -44,7 +44,7 @@ export default class {{ middlewareName }} { /** * Assigning i18n property to the HTTP context */ - ctx.i18n = i18n.locale(language || i18n.defaultLocale) + ctx.i18n = i18nManager.locale(language || i18n.defaultLocale) /** * Binding I18n class to the request specific instance of it.