Skip to content

Instantly share code, notes, and snippets.

@theodesp
Last active November 14, 2019 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theodesp/9bb66cbe94ad172dc42ddb9b53ad9a9b to your computer and use it in GitHub Desktop.
Save theodesp/9bb66cbe94ad172dc42ddb9b53ad9a9b to your computer and use it in GitHub Desktop.
import i18n from 'i18next';
import { initReactI18next } from "react-i18next";
import LanguageDetector from 'i18next-browser-languagedetector';
i18n
.use(initReactI18next)
.use(LanguageDetector)
.init({
// we init with resources
resources: {
en: {
translations: {
"Welcome to React.js": "Welcome to React.js",
"Declarative": "Declarative",
"React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.": "React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.",
"Declarative views make your code more predictable and easier to debug.": "Declarative views make your code more predictable and easier to debug."
}
},
el: {
translations: {
"Welcome to React.js": "Καλώς 'Ηρθατε στο React.js!",
"Declarative": "Δηλωτικό",
"React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.": "To {{name}} καθιστά ανώφελη τη δημιουργία διαδραστικών διεπαφών χρήστη. Σχεδιάστε απλές προβολές για κάθε κράτος στο δικό σας\\n\" +\n" +
" εφαρμογή και το React θα ενημερώσει αποτελεσματικά και θα αποδώσει τα σωστά στοιχεία όταν τα δεδομένα σας " +
" αλλαγές.",
"Declarative views make your code more predictable and easier to debug.": "Οι δηλωτικές προβολές καθιστούν τον κώδικα πιο προβλέψιμο και πιο εύκολο στον εντοπισμό σφαλμάτων."
}
}
},
fallbackLng: 'en',
debug: true,
// have a common namespace used around the full app
ns: ['translations'],
defaultNS: 'translations',
keySeparator: false, // we use content as keys
interpolation: {
escapeValue: false, // not needed for react!!
formatSeparator: ','
},
react: {
wait: true
}
});
export default i18n;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment