Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/make error handling work #27

Merged
merged 4 commits into from
Jun 12, 2020

Conversation

sidoruk-sv
Copy link
Contributor

@sidoruk-sv sidoruk-sv commented Jun 11, 2020

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

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • documentation is changed or added

@sidoruk-sv
Copy link
Contributor Author

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

@jamuhl jamuhl merged commit acc26e1 into i18next:master Jun 12, 2020
@jamuhl
Copy link
Member

jamuhl commented Jun 12, 2020

was published in [email protected]

@sidoruk-sv sidoruk-sv deleted the fix/make-error-handling-work branch June 12, 2020 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is there a way to not fail on invalid translations, but fallback in non-breakable maner
2 participants