i18next / i18next-icu

i18nFormat plugin to use ICU format with i18next
MIT License
81 stars 17 forks source link

Fix/make error handling work #27

Closed sidoruk-sv closed 4 years ago

sidoruk-sv commented 4 years ago

For now, even with #24 implemented i18next-icu will still fail on creation with Error (for missed variable):

"SyntaxError: Expected "," or "}" but "u" found.
    at peg$buildException (webpack-internal:///../node_modules/intl-messageformat-parser/lib/parser.js:365:14)
    at Function.peg$parse (webpack-internal:///../node_modules/intl-messageformat-parser/lib/parser.js:1384:13)
    at new MessageFormat (webpack-internal:///../node_modules/intl-messageformat/lib/core.js:18:27)
    at ICU.parse (webpack-internal:///../node_modules/i18next-icu/dist/commonjs/index.js:127:14)
    at Translator.extendTranslation (webpack-internal:///../node_modules/i18next/dist/esm/i18next.js:724:31)
    at Translator.translate (webpack-internal:///../node_modules/i18next/dist/esm/i18next.js:708:20)
    at I18n.t (webpack-internal:///../node_modules/i18next/dist/esm/i18next.js:2198:80)

Cause the main problem still exists at new IntlMessageFormat(res, lng, this.formats): when it is created peg$parse is invoked for the first time and that will produce Uncaught error.

Fixes #21

Checklist

sidoruk-sv commented 4 years ago

@jamuhl don't know how do you invoke build, but seems like your rebuild will be needed here too

jamuhl commented 4 years ago

was published in i18next-icu@1.4.2