Constructors

  • Parameters

    • Optional_options: InitOptions<object> & { fsTranslationsPath?: string }

    Returns I18n

Accessors

  • get ns(): {
        common: TFunction<"translation", undefined>;
        coreutils: TFunction<"translation", undefined>;
        filesystem: TFunction<"translation", undefined>;
        kernel: TFunction<"translation", undefined>;
        terminal: TFunction<"translation", undefined>;
    }
  • Returns {
        common: TFunction<"translation", undefined>;
        coreutils: TFunction<"translation", undefined>;
        filesystem: TFunction<"translation", undefined>;
        kernel: TFunction<"translation", undefined>;
        terminal: TFunction<"translation", undefined>;
    }

  • get t(): TFunction<["translation", ...string[]], undefined>
  • Returns TFunction<["translation", ...string[]], undefined>

Methods

  • Detects the browser language using the language detector Returns the detected language code (e.g., 'en', 'es')

    Returns string

  • Converts a language code to a locale string Examples: 'en' -> 'en_US', 'es' -> 'es_ES' Falls back to language code if no region mapping exists

    Parameters

    • language: string

    Returns string

  • Parameters

    • fs: I18nFilesystemAdapter
    • OptionalrootPath: string

    Returns Promise<I18nResourceLoadResult>

  • Converts a locale string to a language code Examples: 'en_US' -> 'en', 'es_ES' -> 'es', 'en' -> 'en'

    Parameters

    • locale: string

    Returns string

  • Sets the language for i18next

    Parameters

    • locale: string

      Locale string (e.g., 'en_US', 'es_ES', 'en', 'es')

    Returns void