i18next / i18next-fluent

i18nFormat plugin to use mozilla fluent format with i18next
MIT License
22 stars 9 forks source link

react-fluent example throws error when project is ran locally #8

Open akdetrick opened 2 years ago

akdetrick commented 2 years ago

🐛 Bug Report

react-fluent example does not run due to error thrown by js2ftl.

To Reproduce

  1. Clone the react-i18next repo
  2. cd example/v9.x.x/react-fluent
  3. npm ci
  4. npm run start
js2ftl.js:24 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at js2ftl (js2ftl.js:24:1)
    at BundleStore.createBundle (index.js:174:1)
    at BundleStore.createBundleFromI18next (index.js:182:1)
    at index.js:202:1
    at Array.forEach (<anonymous>)
    at index.js:201:1
    at Array.forEach (<anonymous>)
    at index.js:200:1
    at EventEmitter.js:53:1
    at Array.forEach (<anonymous>)
    at I18n.emit (EventEmitter.js:52:1)
    at i18next.js:203:1
    at done (i18next.js:308:1)
    at Object.callback (i18next.js:322:1)
    at BackendConnector.js:223:1
    at Array.forEach (<anonymous>)
    at Connector.loaded (BackendConnector.js:202:1)
    at BackendConnector.js:315:1
    at BackendConnector.js:256:1
    at index.js:133:1
    at XMLHttpRequest.x.onreadystatechange (ajax.js:92:1)

Your Environment

akdetrick commented 2 years ago

Looks like updating deps in package.json actually resolves the issue:

-    "i18next-fluent": "0.0.3",
-    "i18next-fluent-backend": "0.0.2",
+    "i18next-fluent": "^2",
+    "i18next-fluent-backend": "^0.0.3",

Will submit a PR to close this issue tomorrow.