Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

feat(react-intl): added localization keys for all entries#2634

Merged
ovflowd merged 6 commits into
nodejs:mainfrom
ovflowd:feat/react-intl-locale-keys
Aug 22, 2022
Merged

feat(react-intl): added localization keys for all entries#2634
ovflowd merged 6 commits into
nodejs:mainfrom
ovflowd:feat/react-intl-locale-keys

Conversation

@ovflowd

@ovflowd ovflowd commented Aug 14, 2022

Copy link
Copy Markdown
Member

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npm run lint:js -- --fix and/or npm run lint:md -- --fix for my JavaScript and/or Markdown changes.
    • This is important as most of the cases your code changes might not be correctly linted
  • I have run npm run test to check if all tests are passing, and/or npm run test -- -u to update snapshots if I created and/or updated React Components.
  • I have checked that the build works locally and that npm run build and npm run build-storybook work fine.
  • I've covered new added functionality with unit tests if necessary.

Description

This PR introduces react-intl within all App Components and pages, allowing to the content to be easily translated on the locale files.

This PR also updates tests and snapshots and adds test-utils for react-intl

Related Issues

@codecov-commenter

codecov-commenter commented Aug 14, 2022

Copy link
Copy Markdown

Codecov Report

Merging #2634 (2c0fe09) into main (8f2e959) will decrease coverage by 0.03%.
The diff coverage is 89.28%.

@@            Coverage Diff             @@
##             main    #2634      +/-   ##
==========================================
- Coverage   86.37%   86.33%   -0.04%     
==========================================
  Files         102      104       +2     
  Lines        1064     1083      +19     
  Branches      293      290       -3     
==========================================
+ Hits          919      935      +16     
- Misses        139      142       +3     
  Partials        6        6              
Impacted Files Coverage Δ
src/__fixtures__/hooks.tsx 100.00% <ø> (ø)
src/__fixtures__/page.tsx 100.00% <ø> (ø)
src/components/BlogCard/index.tsx 100.00% <ø> (ø)
src/components/DownloadReleases/DownloadTable.tsx 100.00% <ø> (ø)
src/components/DownloadReleases/index.tsx 100.00% <ø> (ø)
src/components/DownloadToggle/index.tsx 100.00% <ø> (ø)
src/components/Footer/index.tsx 100.00% <ø> (ø)
src/components/Header/index.tsx 95.45% <ø> (-0.20%) ⬇️
src/components/Hero/index.tsx 100.00% <ø> (ø)
src/components/InstallTabs/LinuxPanel/index.tsx 100.00% <ø> (ø)
... and 20 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment thread test-utils.js
@ovflowd ovflowd force-pushed the feat/react-intl-locale-keys branch from 4c6a41f to c2ce122 Compare August 16, 2022 11:55
@ovflowd

ovflowd commented Aug 16, 2022

Copy link
Copy Markdown
Member Author

@benhalverson I moved the tests on the tests/ folder to within src/ as most of the tests were there. I also made a mock for testing-library/react so we avoid needing to import the test-utils.

Basically my last commit is just moving the tests around, fixing eslint issues and that's it.

@rodion-arr

Copy link
Copy Markdown
Contributor

I moved the tests on the tests/ folder to within src/ as most of the tests were there.

And this extremely overcomplicated the review of PR.. I think such changes should be done in separate PRs next time. Because it confuses a lot and does not correlates with PR title
@ovflowd

Comment thread src/i18n/locales/en.json Outdated
@@ -1 +1,73 @@
{}
{
"blog.authors.list.title.by": "by ",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From my experience - translation values should not contain spaces like this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Interesting, is there any real reason why? I believe in some cases it makes sense, but some cases are complex where arbitrary code happens. If you check where they're used, it might make sense. (As I didn't want to refactor the utility itself that is used for the list of authors)

@rodion-arr rodion-arr Aug 17, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Usually it produces bugs in case translation team will accidentally remove spaces in other translation file and words will be merged all together in UI. If we need to have space there reliably - it better to have it in code/css than in translation file

@ovflowd

ovflowd commented Aug 17, 2022

Copy link
Copy Markdown
Member Author

And this extremely overcomplicated the review of PR.. I think such changes should be done in separate PRs next time.

True. I overcomplicated this PR by making such changes here. My process of thought was, "If we need basically to update every test here by updating the imports, I could just then reorganise the structure of the tests too".

But indeed, it was overkill for this PR, will definitely attempt to avoid it in the future.

But rest assured, the tests were not impacted, the changes are just files being moved. You can safely just hide these changes on the diff tab.

@ovflowd

ovflowd commented Aug 21, 2022

Copy link
Copy Markdown
Member Author

Going to get #2654 merged first before rebasing this one and fixing its issues.

@ovflowd ovflowd force-pushed the feat/react-intl-locale-keys branch from c2ce122 to ec27a53 Compare August 22, 2022 14:16
@ovflowd

ovflowd commented Aug 22, 2022

Copy link
Copy Markdown
Member Author

@rodion-arr PR ready to be reviewed 🎉

@ovflowd ovflowd force-pushed the feat/react-intl-locale-keys branch from 2c0fe09 to e7d860b Compare August 22, 2022 19:30
@ovflowd ovflowd merged commit 3d50be5 into nodejs:main Aug 22, 2022
@ovflowd ovflowd deleted the feat/react-intl-locale-keys branch August 22, 2022 19:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants