All files / app/.storybook i18n.ts

0% Statements 0/13
0% Branches 0/1
0% Functions 0/7
0% Lines 0/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
import i18n from "i18next";
import resourcesToBackend from "i18next-resources-to-backend";
import { initReactI18next } from "react-i18next";
 
i18n
  .use(initReactI18next)
  .use(
    resourcesToBackend((language, namespace, callback) => {
      Iif (namespace === "global") {
        import(`resources/locales/${language}.json`)
          .then((resources) => {
            callback(null, resources);
          })
          .catch((error) => {
            callback(error, null);
          });
        return;
      }
      import(`features/${namespace}/locales/${language}.json`)
        .then((resources) => {
          callback(null, resources);
        })
        .catch((error) => {
          callback(error, null);
        });
    })
  )
  .init({
    fallbackLng: "en",
    compatibilityJSON: "v3",
    debug: process.env.NODE_ENV === "development",
    interpolation: {
      // React does this by default already
      escapeValue: false,
    },
    ns: ["global"],
    returnEmptyString: false,
  });
 
export default i18n;