Skip to content

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
@ksen0 ksen0 moved this from FES i18n to Done in p5.js 2.0: FES Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants