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

[2754] Swap out i18n-js for react-18next #2770

Merged
merged 27 commits into from
Sep 16, 2024
Merged

[2754] Swap out i18n-js for react-18next #2770

merged 27 commits into from
Sep 16, 2024

Conversation

fpena
Copy link
Collaborator

@fpena fpena commented Sep 10, 2024

Please verify the following:

  • yarn test jest tests pass with new tests, if relevant
  • yarn lint eslint checks pass with new code, if relevant
  • yarn format:check prettier checks pass with new code, if relevant
  • README.md (or relevant documentation) has been updated with your changes

Describe your PR

This PR replaces the i18n-js library with i18next to enhance internationalization in the project. The migration ensures better support for translations, including improved handling of locale-specific formats, pluralization, and more efficient loading of translation resources.

Key Changes:

  • Replaced all instances of i18n-js with i18next across the codebase.
  • Updated translation initialization logic to use initReactI18next from the i18next library.
  • Refactored translation key format: e.g., from "common.ok" to "common:ok".
  • Updated all relevant unit tests reflect changes in the translation library.

Note: We will also create a cookbook recipe later that references this PR for Ignite users who want to migrate from i18n-js to i18next and are using Ignite 9.x or less.

Video

Simulator.Screen.Recording.-.iPhone.15.-.2024-09-12.at.13.44.15.mp4

@fpena fpena changed the base branch from master to v10 September 10, 2024 15:23
@fpena fpena changed the title Fp/react i18next [2754] Swap out i18n-js for react-18next Sep 10, 2024
@fpena fpena marked this pull request as ready for review September 12, 2024 20:33
Copy link
Contributor

@frankcalise frankcalise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

What was the motivation behind the screen:some.key naming scheme change?

Not opposed to it, just made a bunch of extra changes because of it.

boilerplate/package.json Outdated Show resolved Hide resolved
@fpena
Copy link
Collaborator Author

fpena commented Sep 13, 2024

Looking good!

What was the motivation behind the screen:some.key naming scheme change?

Not opposed to it, just made a bunch of extra changes because of it.

@frankcalise it is the namespace separator for i18next. There's more context about it here.

Copy link
Contributor

@frankcalise frankcalise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@frankcalise frankcalise linked an issue Sep 13, 2024 that may be closed by this pull request
@fpena fpena merged commit 7b8c5cc into v10 Sep 16, 2024
1 check passed
@fpena fpena deleted the fp/react-i18next branch September 16, 2024 14:52
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.

Swap out i18n-js for react-18next
3 participants