Skip to content

enableSelector: true doesn't work with custom keySeparator #2341

@vchirikov

Description

@vchirikov

Hi, I tried new enableSelector feature and found a couple of bugs.

  1. InitOptions doesn't have enableSelector, so I use workaround to add it there
  interface CustomPluginOptions {
    enableSelector: true;
  }
  1. after this vscode/Typescript works well, autocomplete works as expected, but:
  2. i18next doesn't work with proxy
Image

client side i18n initialized like this:

export const initI18next = (
  initLocaleContent: ResourceLanguage | null,
  initLocale: Locale,
  initNamespace: Namespace = defaultNamespace
) => {
  const instance = createInstance();
  void instance.use(resourcesToBackend(resourceLanguageLoader)).init({
    enableSelector: true,
    partialBundledLanguages: true,
    debug: false,
    ...(initLocaleContent
      ? {
          resources: { [initLocale]: { [initNamespace]: initLocaleContent } },
          lng: initLocale,
          preload: [initLocale],
        }
      : {
          lng: 'cimode',
        }),
    supportedLngs: locales,
    fallbackLng: defaultLocale,
    defaultNS: defaultNamespace,
    fallbackNS: defaultNamespace,
    ns: initNamespace,
    interpolation: {
      // react handles this
      escapeValue: false,
    },
    react: {
      useSuspense: true,
    },
    nsSeparator: ':::',
    keySeparator: '::',
    pluralSeparator: '##',
    contextSeparator: '##',
  });
  return instance;
};

As you can see on screenshot looks like proxy doesn't use keySeparator

Your Environment

versions:

    "i18next": "25.4.1",
    "i18next-resources-to-backend": "1.2.1",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions