Skip to content

add a friendly localized error message helper #6099

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

outofambit
Copy link
Contributor

@outofambit outofambit commented Apr 4, 2023

Supports #3384

I realized that while we have support to show localized console messages, there isn't an easy way to use it in the codebase outside of the fes core code. This new helper would make it so someone can add a new console message with

p5._friendlyLocalizedError('messageKey');

when messageKey is also added a key into our localization json files. And then it could be translated into other languages.

Open to ideas on ways to make this simpler to use! I'd love to have more localized console messages, there's a lot outside of the fes folder that we could add!

Changes:

  • adds a friendlyLocalizedError() helper so its easier to add new localized console messages
  • includes a couple examples of how to use it

PR Checklist

  • npm run lint passes
  • [Inline documentation] is included / updated
  • [Unit tests] are included / updated

@outofambit outofambit changed the title add a friendly localized error message helper (and use it) add a friendly localized error message helper Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: FES i18n
Development

Successfully merging this pull request may close these issues.

2 participants