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

Update Nuxt i18n #5176

Merged
merged 1 commit into from
Nov 25, 2024
Merged

Update Nuxt i18n #5176

merged 1 commit into from
Nov 25, 2024

Conversation

obulat
Copy link
Contributor

@obulat obulat commented Nov 21, 2024

Fixes

Description

This PR updates Nuxt i18n, and adds the necessary changes:

  • the locale files are now located in frontend/i18n/locales/ instead of frontend/src/locales/
  • the object returned from useI18n is now typed differently (uses the locales available in the app), and it's difficult to get it correct in all environment (unit/Playwright tests, type checks and production), so I refactored the functions that accept i18n object to accept i18n.t instead.
  • the fallback locales were removed when migrating to Nuxt 3; added back in this PR.
  • the custom pluralization rules created in the follow up PR Rewrite the i18n scripts #5177 (from the data downloaded from GlotPress) added.

The unused i18n-check script was removed

Testing Instructions

The CI should pass, and the app should work correctly without warning.
Run the i18n scripts and check that they all work. Delete locale files between running the scripts.

  • ov just frontend/run i18n:en
  • ov just frontend/run i18n:copy-test-locales
  • ov just frontend/run i18n
  • ov just frontend/run i18n:copy-test-locales
  • ov just frontend/run i18n:no-get (without removing the existing locales: check that they are reused and saved as valid-locales.json)
  • ov just frontend/run i18n:create-locales-list
  • ov just frontend/run i18n:get-translations
  • ov just frontend/run i18n:update-locales
  • ov just frontend/run i18n:generate-pot

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (ov just catalog/generate-docs for catalog
    PRs) or the media properties generator (ov just catalog/generate-docs media-props
    for the catalog or ov just api/generate-docs for the API) where applicable.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@obulat obulat requested a review from a team as a code owner November 21, 2024 03:32
@openverse-bot openverse-bot added 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Nov 21, 2024
Copy link

github-actions bot commented Nov 21, 2024

Latest k6 run output1

     ✓ status was 200

     checks.........................: 100.00% ✓ 6400      ✗ 0   
     data_received..................: 1.5 GB  8.2 MB/s
     data_sent......................: 838 kB  4.7 kB/s
     http_req_blocked...............: avg=8.96µs   min=1.91µs  med=3.86µs   max=3.44ms  p(90)=5.31µs   p(95)=5.78µs  
     http_req_connecting............: avg=4.34µs   min=0s      med=0s       max=3.38ms  p(90)=0s       p(95)=0s      
     http_req_duration..............: avg=626.22ms min=39.92ms med=543.75ms max=2.42s   p(90)=1.13s    p(95)=1.22s   
       { expected_response:true }...: avg=626.22ms min=39.92ms med=543.75ms max=2.42s   p(90)=1.13s    p(95)=1.22s   
   ✓ http_req_failed................: 0.00%   ✓ 0         ✗ 6400
     http_req_receiving.............: avg=162.76µs min=41.32µs med=114.71µs max=33.81ms p(90)=182.15µs p(95)=217.54µs
     http_req_sending...............: avg=29.6µs   min=6.14µs  med=19.34µs  max=25.84ms p(90)=25.17µs  p(95)=27.36µs 
     http_req_tls_handshaking.......: avg=0s       min=0s      med=0s       max=0s      p(90)=0s       p(95)=0s      
     http_req_waiting...............: avg=626.02ms min=39.75ms med=543.62ms max=2.42s   p(90)=1.13s    p(95)=1.22s   
     http_reqs......................: 6400    35.533319/s
     iteration_duration.............: avg=3.34s    min=1.22s   med=2.75s    max=9.65s   p(90)=6.53s    p(95)=6.85s   
     iterations.....................: 1200    6.662497/s
     vus............................: 5       min=5       max=30
     vus_max........................: 30      min=30      max=30

Footnotes

  1. This comment will automatically update with new output each time k6 runs for this PR

@obulat obulat marked this pull request as draft November 21, 2024 06:14
@obulat obulat added 🟨 priority: medium Not blocking but should be addressed soon 💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Nov 21, 2024
Copy link

Full-stack documentation: https://docs.openverse.org/_preview/5176

Please note that GitHub pages takes a little time to deploy newly pushed code, if the links above don't work or you see old versions, wait 5 minutes and try again.

You can check the GitHub pages deployment action list to see the current status of the deployments.

@obulat obulat force-pushed the update-only-nuxt-i18n branch 2 times, most recently from 203c807 to 2d8ae64 Compare November 21, 2024 12:42
@openverse-bot openverse-bot added the 🧱 stack: mgmt Related to repo management and automations label Nov 21, 2024
@obulat obulat marked this pull request as ready for review November 21, 2024 13:01
@obulat obulat requested a review from a team as a code owner November 21, 2024 13:01
@obulat obulat marked this pull request as draft November 25, 2024 04:37
@obulat obulat force-pushed the update-only-nuxt-i18n branch 2 times, most recently from 362799e to b0b0537 Compare November 25, 2024 05:35
@obulat obulat marked this pull request as ready for review November 25, 2024 10:33
Copy link
Member

@krysal krysal left a comment

Choose a reason for hiding this comment

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

Big PR. Hopes it facilitates the locales management! The commands work for me.

@obulat obulat merged commit eddb335 into main Nov 25, 2024
55 checks passed
@obulat obulat deleted the update-only-nuxt-i18n branch November 25, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🧰 goal: internal improvement Improvement that benefits maintainers, not users 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: documentation Related to Sphinx documentation 🧱 stack: frontend Related to the Nuxt frontend 🧱 stack: mgmt Related to repo management and automations
Projects
Status: 🤝 Merged
Development

Successfully merging this pull request may close these issues.

3 participants