remix-i18next - v7.2.0
    Preparing search index...

    Class RemixI18Next

    Index

    Constructors

    Methods

    • Return a TFunction that can be used to translate strings server-side. This function is fixed to a specific namespace.

      Type Parameters

      • N extends string | readonly [string, string] = "translation"
      • KPrefix extends KeyPrefix<Ns> = undefined

      Parameters

      • locale: string
      • Optionalnamespaces: N

        The namespaces to use for the T function. (Default: translation).

      • Optionaloptions: Omit<InitOptions<object>, "react"> & { keyPrefix?: KPrefix }

        The i18next init options and the key prefix to prepend to translation keys.

      Returns Promise<TFunction<FallbackNs<N>, KPrefix>>

    • Return a TFunction that can be used to translate strings server-side. This function is fixed to a specific namespace.

      Type Parameters

      • N extends string | readonly [string, string] = "translation"
      • KPrefix extends KeyPrefix<Ns> = undefined

      Parameters

      • request: Request
      • Optionalnamespaces: N

        The namespaces to use for the T function. (Default: translation).

      • Optionaloptions: Omit<InitOptions<object>, "react"> & { keyPrefix?: KPrefix }

        The i18next init options and the key prefix to prepend to translation keys.

      Returns Promise<TFunction<FallbackNs<N>, KPrefix>>

    • Detect the current locale by following the order defined in the detection.order option. By default the order is

      • searchParams
      • cookie
      • session
      • header And finally the fallback language.

      Parameters

      Returns Promise<string>

    • Get the namespaces required by the routes which are going to be rendered when doing SSR.

      Parameters

      • context: EntryContext

        The EntryContext object received by handleRequest in entry.server

      Returns string[]

      await instance.init({
      ns: i18n.getRouteNamespaces(context),
      // ...more options
      });