Skip to content

prefer react-i18next useTranslation hook #2045

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

Merged

Conversation

lindapaiste
Copy link
Collaborator

Changes:

  • In existing function components, access the t function from react-i18next via const { t } = useTranslation(); rather than the withTranslation HOC or by passing it down from a parent.
  • Converted EditorAccessibility ErrorModal, and ShareModal from class components to function components as they didn't use any lifecycle methods, so the conversion is trivial.

I'm not sure if it's better to do refactoring on a "one change at a time" basis like this, or a "one component at a time" basis. The advantages of "one change at a time" is that it avoids versioning issues for dependencies such as react-router which need to be updated before we can use hooks.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

@release-com
Copy link

release-com bot commented Aug 2, 2022

Release Environments

This pull request environment is provided by Release, learn more!
To see the status of the environment click on Environment Status below.

  • p5.js-web-editor

🔧Environment Status : https://app.releasehub.com/public/Processing%20Foundation/env-ddc90c8f70

@raclim raclim merged commit 269ca22 into processing:develop Mar 9, 2023
@lindapaiste lindapaiste deleted the refactor/prefer-use-translation branch August 8, 2023 02:02
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.

2 participants