Home > AI > Frontend > react-i18next >

put translations in seperate files

  import common_de from "./translations/de/common.json";
    import common_en from "./translations/en/common.json";

    i18next.init({
        interpolation: { escapeValue: false },  // React already does escaping
        lng: 'en',                              // language to use
        resources: {
            en: {
                common: common_en               // 'common' is our custom namespace
            },
            de: {
                common: common_de
            },
        },
    });

Leave a Reply