Skip to content

Instantly share code, notes, and snippets.

@hirataya hirataya/hello_world.jsx
Last active Dec 11, 2018

Embed
What would you like to do?
React + i18next
import React from "react";
import i18n from "path/to/i18n.js";
const HelloWorld = () => {
return(<p>{ i18n.t("hello") }</p>);
}
export default HelloWorld;
import i18next from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import enLocalesTranslationJson from "json5-loader!locales/en";
import jaLocalesTranslationJson from "json5-loader!locales/ja";
i18next.use(LanguageDetector).init({
fallbackLng: "ja",
debug: true,
resources: {
en: {translation: enLocalesTranslationJson},
ja: {translation: jaLocalesTranslationJson},
},
});
export default i18next;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.