Skip to content

CONSOLE-5428: follow up la migration du i18next-cli - #16926

Open
logonoff wants to merge 2 commits into
openshift:mainfrom
logonoff:i18n-sdk
Open

CONSOLE-5428: follow up la migration du i18next-cli#16926
logonoff wants to merge 2 commits into
openshift:mainfrom
logonoff:i18n-sdk

Conversation

@logonoff

@logonoff logonoff commented Aug 7, 2026

Copy link
Copy Markdown
Member

More follow up for #16864 / #16796 + other cleanup

Solution description:

  • Reintroduce unit tests
  • Update INTERNATIONALIZATION.md
  • Rename yarn build-plugin-sdk to yarn generate to fix muscle memory
  • Translate Memory string that was not translated
  • Update remaining i18next-parser references to i18next-cli
  • Remove references to cache-loader, protractor in scripts and gitignore

Did not reintroduce pluralization script because the defaults were kind of bad. It generated stuff like this:

  "Mark <1>{{count}}</1> nodes as unschedulable?_one": "Mark <1>{{count}}</1> nodes as unschedulable?",
  "Mark <1>{{count}}</1> nodes as unschedulable?_other": "Mark <1>{{count}}</1> nodes as unschedulable?s",

which is objectively worse than not doing anything at all. However I added a test so that the plural string can never be the same as the singular one. For cases that genuinely should have plural===singular, change from count to something else so those strings aren't created in the first place.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected singular and plural wording across machine, replica, namespace, session, and PodDisruptionBudget messages.
    • Improved selection and interpolation messages for clearer counts and screen-reader announcements.
    • Localized the topology memory tooltip label and corrected translation markup.
  • Improvements

    • Updated translation extraction and generation workflows.
    • Improved translation handling for dynamic console extensions.
    • Added validation to help prevent duplicate singular and plural translations.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot

openshift-ci-robot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@logonoff: This pull request references CONSOLE-5428 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

More follow up for #16864 / #16796 + other cleanup

Solution description:

  • Reintroduce unit tests
  • Update INTERNATIONALIZATION.md
  • Rename yarn build-plugin-sdk to yarn generate to fix muscle memory
  • Translate Memory string that was not translated
  • Update remaining i18next-parser references to i18next-cli
  • Remove references to cache-loader, protractor in scripts and gitignore

Did not reintroduce pluralization script because the defaults were kind of bad. It generated stuff like this:

 "Mark <1>{{count}}</1> nodes as unschedulable?_one": "Mark <1>{{count}}</1> nodes as unschedulable?",
 "Mark <1>{{count}}</1> nodes as unschedulable?_other": "Mark <1>{{count}}</1> nodes as unschedulable?s",

which is objectively worse than not doing anything at all. However I added a test so that the plural string can never be the same as the singular one. For cases that genuinely should have plural===singular, change from count to something else so those strings aren't created in the first place.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 14b7670b-c6e7-4c21-9a59-5da9421ce428

📥 Commits

Reviewing files that changed from the base of the PR and between 9a6aec1 and 217040b.

📒 Files selected for processing (1)
  • frontend/__tests__/i18n-structure.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/tests/i18n-structure.spec.ts

Walkthrough

The change centralizes console-extension translation extraction, updates frontend generation and validation commands, and corrects English localization keys, plural forms, interpolation variables, and translated labels.

Changes

Internationalization updates

Layer / File(s) Summary
Shared console-extension extraction plugin
frontend/i18n-scripts/*, frontend/i18next.config.ts, dynamic-demo-plugin/i18next.config.ts
Adds a shared i18next-cli plugin that reads console-extension JSON files, extracts %namespace~key% values, registers translation keys, and handles invalid files and key formats.
Frontend generation and validation flow
frontend/package.json, Dockerfile.plugins.demo, test-frontend.sh, INTERNATIONALIZATION.md, frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx, .gitignore, clean-frontend.sh
Build workflows now use yarn generate. Validation adds yarn knip and runs cycle checks after unit tests. Documentation and cleanup commands use the updated workflow.
Localization keys and consumers
frontend/packages/*/locales/en/*, frontend/public/locales/en/public.json, frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx, frontend/packages/topology/src/components/list-view/cells/MemoryCell.tsx, frontend/public/components/*, frontend/__tests__/i18n-structure.spec.ts
Corrects English singular and plural values, standardizes interpolation keys and markup, localizes the memory tooltip, updates translation calls, and adds a test for identical plural values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: component/shared

Suggested reviewers: cajieh, jhadvig

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main solution, but it omits most required template sections, including analysis, test cases, browser conformance, and reviewers. Complete the required template sections, especially root cause, test setup, test cases, browser conformance, additional information, and reviewers or assignees.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title includes the Jira issue and clearly identifies the follow-up work for the i18next-cli migration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR adds only Jest tests, not Ginkgo tests; all added describe/it titles are static string literals with no dynamic run-dependent values.
Test Structure And Quality ✅ Passed The PR adds TypeScript/Jest tests only; no changed _test.go files or Ginkgo constructs exist, so these Ginkgo-specific requirements do not apply.
Microshift Test Compatibility ✅ Passed The PR adds only frontend Jest/TypeScript tests; it adds no Ginkgo e2e tests or MicroShift-sensitive OpenShift API references.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The PR adds only frontend TypeScript/Jest tests; it adds no Go/Ginkgo e2e tests or multi-node cluster assumptions, so the SNO check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed The PR changes frontend i18n/UI code, scripts, documentation, and ignore files only; it adds no deployment manifests, operator/controller code, or scheduling constraints.
Ote Binary Stdout Contract ✅ Passed The aggregate PR diff contains no Go files, OTE binaries, or Ginkgo suite setup; changes are limited to frontend, localization, and shell/config files.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR adds Jest TypeScript specs, not Ginkgo e2e tests; they mock filesystem reads and contain no IPv4 literals or external network access.
No-Weak-Crypto ✅ Passed The complete PR diff adds no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, crypto API, custom crypto, or secret-comparison code.
Container-Privileges ✅ Passed The PR adds no privileged, host namespace, SYS_ADMIN, or allowPrivilegeEscalation:true settings; Dockerfile.plugins.demo runs its final image as USER 1001, and the demo manifest is restrictive and...
No-Sensitive-Data-In-Logs ✅ Passed The PR adds only build-time warnings/errors for manifest paths, parse failures, and invalid translation keys; no passwords, tokens, API keys, PII, session IDs, or customer data are logged.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci
openshift-ci Bot requested review from cajieh and jhadvig August 7, 2026 19:37
@openshift-ci openshift-ci Bot added component/core Related to console core functionality component/olm Related to OLM component/topology Related to topology kind/demo-plugin Related to dynamic-demo-plugin kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Aug 7, 2026
@logonoff

logonoff commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

/label px-approved
/label docs-approved

@openshift-ci openshift-ci Bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR labels Aug 7, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/i18n-scripts/ConsoleExtensionsI18nextCliPlugin.ts`:
- Around line 65-71: Update the key parsing loop to reject any fullKey
containing anything other than exactly one `~` separator, rather than truncating
extra segments via split('~', 2). Preserve the existing warning path for invalid
values and add a regression test covering `%ns~key~suffix%` that verifies no key
is registered.

In `@INTERNATIONALIZATION.md`:
- Line 58: Update the extraction description in INTERNATIONALIZATION.md to
clearly distinguish runtime key resolution by i18next from static key extraction
by i18next-cli, explicitly stating that the CLI does not execute code and
therefore cannot resolve dynamic expressions into translation keys.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: fad072cb-b7ad-4fb6-a5df-3f27c3db2139

📥 Commits

Reviewing files that changed from the base of the PR and between 5a90b1e and f384d43.

📒 Files selected for processing (22)
  • .gitignore
  • Dockerfile.plugins.demo
  • INTERNATIONALIZATION.md
  • clean-frontend.sh
  • dynamic-demo-plugin/i18next.config.ts
  • frontend/.prettierignore
  • frontend/__tests__/i18n-structure.spec.ts
  • frontend/i18n-scripts/ConsoleExtensionsI18nextCliPlugin.ts
  • frontend/i18n-scripts/__tests__/ConsoleExtensionsI18nextCliPlugin.spec.ts
  • frontend/i18next.config.ts
  • frontend/jest.config.ts
  • frontend/package.json
  • frontend/packages/console-app/locales/en/console-app.json
  • frontend/packages/console-app/src/components/data-view/ConsoleDataView.tsx
  • frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx
  • frontend/packages/operator-lifecycle-manager/locales/en/olm.json
  • frontend/packages/topology/locales/en/topology.json
  • frontend/packages/topology/src/components/list-view/cells/MemoryCell.tsx
  • frontend/public/components/control-plane-machine-set.tsx
  • frontend/public/components/impersonate-notifier.tsx
  • frontend/public/locales/en/public.json
  • test-frontend.sh
💤 Files with no reviewable changes (3)
  • frontend/.prettierignore
  • frontend/jest.config.ts
  • clean-frontend.sh

Comment thread frontend/i18n-scripts/ConsoleExtensionsI18nextCliPlugin.ts
Comment thread INTERNATIONALIZATION.md Outdated

@rhamilto rhamilto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, but will let @cajieh tag as the i18n SME.
/approve

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: logonoff, rhamilto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 7, 2026
@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@logonoff: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. component/core Related to console core functionality component/olm Related to OLM component/topology Related to topology docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/demo-plugin Related to dynamic-demo-plugin kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated px-approved Signifies that Product Support has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants