i18n.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import i18n from 'i18next'
  2. import { reactI18nextModule } from 'react-i18next'
  3. import { frLib, enLib } from 'tracim_frontend_lib'
  4. import en from '../i18next.scanner/en/translation.json'
  5. import fr from '../i18next.scanner/fr/translation.json'
  6. // get translation files of apps
  7. // theses files are generated by build_appname.sh
  8. const htmlDocEnTranslation = require('../dist/app/html-document_en_translation.json')
  9. const htmlDocFrTranslation = require('../dist/app/html-document_fr_translation.json')
  10. i18n
  11. .use(reactI18nextModule)
  12. .init({
  13. fallbackLng: 'en',
  14. // have a common namespace used around the full app
  15. ns: ['translation'], // namespace
  16. defaultNS: 'translation',
  17. debug: true,
  18. react: {
  19. wait: true
  20. },
  21. resources: {
  22. en: {
  23. translation: {
  24. ...enLib, // fronted_lib
  25. ...en, // frontend
  26. ...htmlDocEnTranslation // html-document
  27. }
  28. },
  29. fr: {
  30. translation: {
  31. ...frLib, // fronted_lib
  32. ...fr, // frontend
  33. ...htmlDocFrTranslation // html-document
  34. }
  35. }
  36. }
  37. })
  38. export default i18n