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

Frontend i18n #382

Merged
merged 7 commits into from
Jan 11, 2022
Merged

Frontend i18n #382

merged 7 commits into from
Jan 11, 2022

Conversation

codemonkey800
Copy link
Collaborator

@codemonkey800 codemonkey800 commented Jan 7, 2022

Description

This PR along with several other PRs implement i18n for the frontend of the napari hub. This works by using both Next.js' Internationalized Routing Feature, and the excellent i18n library next-i18next for managing i18n state.

Release Plan

The implementation is split into separate PRs to make it easier to review. When all the PRs are reviewed and ready to merge, I'll merge them one by one into each other until all dependent PRs are merged into this one. Finally, I'll merge this PR to push the i18n feature to staging.

Pull Requests

  1. Frontend i18n #382: (this PR) Adds locale + fixture data, and it removes dead code for the now removed development status filter.
  2. Frontend i18n - next-i18next setup and helper utilities + components #383: Sets up i18n infrastructure.
  3. Frontend i18n - Refactor hub strings #384: Replaces all raw strings with i18n translations.

Demos

English

https://i18n-test-frontend.dev.imaging.cziscience.com

If everything is working correctly, there should be no noticeable difference since it's an underlying change.

Spanish

https://i18n-test-frontend.dev.imaging.cziscience.com/es

This version uses text translated using Google Translate for demonstration.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #176695: Intl integration.

@codemonkey800 codemonkey800 marked this pull request as ready for review January 7, 2022 16:57
@codemonkey800
Copy link
Collaborator Author

The main advantages to having this are:

  1. We now have a central location for all copy used in the frontend.
  2. Separates the rendering logic from the text content.
  3. Developers and non-developers can modify the copy without touching code.
  4. Reduces duplication of commonly used strings across the application.
  5. Provides an easier way to find strings (grep the i18nkey. for example grep common:errors).
  6. Opens up the possibility for adding new languages in the future.

Copy link
Contributor

@klai95 klai95 left a comment

Choose a reason for hiding this comment

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

Nicely done!

Copy link
Member

@kne42 kne42 left a comment

Choose a reason for hiding this comment

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

LGTM

…383)

* next-i18next setup

* i18n type definitions

* I18n component

* i18n for pages

* i18n for error pages

* i18n for MDX files

* Update snapshots

* Fix type errors

* Frontend i18n - Refactor hub strings (#384)

* i18n for common components

* i18n for AppBar

* i18n for CategoryChip

* i18n for Footer

* i18n for MetadataHighlighter

* i18n for MetadataList

* i18n for PluginDetails

* i18n for PluginSearch

* i18n for SearchBar

* i18n for SignupForm

* Fix lint errors

* Mock i18n helpers for testing

* Mock i18n strings for I18n component

* Fix type error

* Fix e2e test errors

* Fix plugin details layout for preview

* Added getSections() for typing

* Change to absolute import

* Fix GH checks errors

* i18n for page metadata

* Fixed i18n not working for page metadata

* Disable rendering PageMetadata for preview page

* Fix page metadata for MDX pages

* Refactor i18n types
@codemonkey800 codemonkey800 merged commit a39fcdb into main Jan 11, 2022
@codemonkey800 codemonkey800 deleted the jeremy/sc-176695/i18n-integration branch January 11, 2022 01:06
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.

3 participants