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

feat(i18n): allow setting i18n namespaces via an environment variable #1527

Merged
merged 3 commits into from
Jan 9, 2025

Conversation

aptmac
Copy link
Member

@aptmac aptmac commented Jan 9, 2025

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Fixes: #1526

Description of the change:

This change allows the i18n namespace(s) to be set as an environment variable.

To do so, I've added useCryostatTranslation to @i18n/i18nextUtil which is just useTranslation with the required namespaces being set.

I've also moved i18nResources and i18nLanguages from @i18n/config to @i18n/i18nextUtil, because I was encountering issues where the Settings page was breaking on the Console plugin side and using a different i18n object than what the Console was expecting.

I have a branch for the console plugin that includes some work to use these changes: aptmac/cryostat-openshift-console-plugin@c8d2d54

At the moment that branch is out of sync with upstream, I'll be fixing that up soon. That commit includes the ability to combine the cryostat-web common and public with the console plugin side common, and renames it to plugin__cryostat-plugin so it can be picked up by the Console.

Motivation for the change:

This change is helpful because it will allow the console plugin to pass it's i18n namespace (something like plugin__cryostat-plugin) and allow the cryostat-web pages to access the localized strings.

Before

(nothing changes for cryostat-web, but here's the console plugin):

Screenshot from 2025-01-09 11-52-35

After

Screenshot from 2025-01-09 11-52-45

@github-actions github-actions bot added the needs-triage Needs thorough attention from code reviewers label Jan 9, 2025
@aptmac aptmac added the feat New feature or request label Jan 9, 2025
@andrewazores andrewazores self-requested a review January 9, 2025 17:02
@andrewazores andrewazores added safe-to-test and removed needs-triage Needs thorough attention from code reviewers labels Jan 9, 2025
@andrewazores andrewazores merged commit 534f939 into cryostatio:main Jan 9, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request safe-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Allow setting i18n namespaces via an environment variable
2 participants