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

Add minimal translation functionality without dependency on React #2554

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

Conversation

ewajm-shopify
Copy link

@ewajm-shopify ewajm-shopify commented Feb 9, 2023

Description

Per the final comment in that issue

There's a gap here for a simpler version of i18n that is designed for usage in libraries

I wanted to try and take a step in this direction by adding a somewhat more robust version of polaris's I18n approach (preserving support for pluralization and ordinals), in a place where it could be more accessible to other projects.

SimpleI18n provides the following:

  • supports plurals and ordinals
  • allows replacements using {} syntax only
  • translations must be passed in by user
  • multiple translation libraries may be provided and are assumed to be in 'primary locale -> fallback locale' order

One of my goals was to minimize repeated code between SimpleI18n and the react-I18n I18n object, which is why I didn't try to bring over the formatting functionality.

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.

None yet

1 participant