i18next-scanner.config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module.exports = {
  2. input: [
  3. "src/**/*.{js,jsx}",
  4. // Use ! to filter out files or directories
  5. "!src/**/*.test.{js,jsx}",
  6. "!src/i18n/**",
  7. "!**/node_modules/**",
  8. ],
  9. output: "./",
  10. options: {
  11. debug: true,
  12. func: {
  13. list: ["i18next.t", "i18n.t", "t"],
  14. extensions: [".js", ".jsx"],
  15. },
  16. trans: {
  17. component: "Trans",
  18. i18nKey: "i18nKey",
  19. defaultsKey: "defaults",
  20. extensions: [".js", ".jsx"],
  21. fallbackKey: function (ns, value) {
  22. return value;
  23. },
  24. acorn: {
  25. ecmaVersion: 11, // defaults to 10
  26. sourceType: "module", // defaults to 'module'
  27. // Check out https://github.com/acornjs/acorn/tree/master/acorn#interface for additional options
  28. },
  29. },
  30. lngs: ["en", "fr", "it"],
  31. ns: ["locale", "resource"],
  32. defaultLng: "en",
  33. defaultNs: "resource",
  34. defaultValue: "__NOT_TRANSLATED__",
  35. resource: {
  36. loadPath: "src/i18n/{{lng}}.json",
  37. savePath: "src/i18n/{{lng}}.json",
  38. jsonIndent: 2,
  39. lineEnding: "\n",
  40. },
  41. nsSeparator: false, // namespace separator
  42. keySeparator: false, // key separator
  43. interpolation: {
  44. prefix: "{{",
  45. suffix: "}}",
  46. },
  47. },
  48. };