Skip to content

OCPBUGS-33836: quickstart page i18n misses (Fix Quick Starts i18n bundle lookup for zh-CN)#16819

Open
cajieh wants to merge 1 commit into
openshift:mainfrom
cajieh:OCPBUGS-74310-quickstart-items-i18n
Open

OCPBUGS-33836: quickstart page i18n misses (Fix Quick Starts i18n bundle lookup for zh-CN)#16819
cajieh wants to merge 1 commit into
openshift:mainfrom
cajieh:OCPBUGS-74310-quickstart-items-i18n

Conversation

@cajieh

@cajieh cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Analysis / Root cause:
Quick Starts chrome strings (for example "Filter by keyword...", "Status") are not translated via t(). Console loads the full console-app resource bundle and passes it to PatternFly Quick Starts with i18n.getResourceBundle(language, 'console-app').

Language preference stores Chinese as zh-CN, but Console i18n is configured with load: 'languageOnly', so locale files are stored under zh. Looking up the bundle with zh-CN returned undefined, and PatternFly fell back to English. The rest of Console was unaffected because it uses t(), which resolves zh-CNzh correctly.

Related history: OCPBUGS-29365 / #13612 changed the preference value from zh to zh-CN, which exposed this Quick Starts lookup mismatch.

Solution description:
Use i18next's resolvedLanguage when loading the Quick Starts console-app resource bundle, with 'en' as a fallback:

  • quick-start-context.tsx — initial context values passed to PatternFly
  • useLanguage.tslanguageChanged handler that updates the bundle via setResourceBundle

resolvedLanguage is the language i18next actually resolved/loaded (for example zh when preference is zh-CN), which matches where resources are stored under load: 'languageOnly'. See https://www.i18next.com/overview/api#resolvedlanguage.

Also guard getResourceBundle with ?? {} so a missing bundle does not pass undefined into processing / PatternFly.

This does not change language preference storage, locale JSON files, or dynamic plugin i18n (plugins use their own plugin__* namespaces and t()).

Screenshots / screen recording:
Before:
e

After
f

Test setup:

  1. Log in to Console.
  2. Set User Preferences → Language → 中文 / Chinese (zh-CN).
  3. Open Quick Starts (Help menu or /quickstart).

Test cases:

  1. With language set to Chinese, Quick Starts catalog chrome strings are translated (for example "Filter by keyword..." → "按关键字过滤...", "Status" → "状态").
  2. Switch language English → Chinese and confirm chrome strings update without a full reload.
  3. Switch language Chinese → English and confirm chrome strings return to English.
  4. Spot-check another language (for example Japanese or Korean) still loads the correct Quick Starts chrome strings.
  5. Confirm dynamic plugin pages that use t() are unchanged.

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Improved language detection when switching languages.
  * Prevented missing translation resources from causing issues in quick-start content.
  * Ensured quick-start translations remain available and process correctly, including pseudolocalization.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

@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 added jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-74310, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:
Quick Starts chrome strings (for example "Filter by keyword...", "Status") are not translated via t(). Console loads the full console-app resource bundle and passes it to PatternFly Quick Starts with i18n.getResourceBundle(language, 'console-app').

Language preference stores Chinese as zh-CN, but Console i18n is configured with load: 'languageOnly', so locale files are stored under zh. Looking up the bundle with zh-CN returned undefined, and PatternFly fell back to English. The rest of Console was unaffected because it uses t(), which resolves zh-CNzh correctly.

Related history: OCPBUGS-29365 / #13612 changed the preference value from zh to zh-CN, which exposed this Quick Starts lookup mismatch.

Solution description:
Use i18next's resolvedLanguage when loading the Quick Starts console-app resource bundle, with 'en' as a fallback:

  • quick-start-context.tsx — initial context values passed to PatternFly
  • useLanguage.tslanguageChanged handler that updates the bundle via setResourceBundle

resolvedLanguage is the language i18next actually resolved/loaded (for example zh when preference is zh-CN), which matches where resources are stored under load: 'languageOnly'. See https://www.i18next.com/overview/api#resolvedlanguage.

Also guard getResourceBundle with ?? {} so a missing bundle does not pass undefined into processing / PatternFly.

This does not change language preference storage, locale JSON files, or dynamic plugin i18n (plugins use their own plugin__* namespaces and t()).

Screenshots / screen recording:
Before:
e

After
f

Test setup:

  1. Log in to Console.
  2. Set User Preferences → Language → 中文 / Chinese (zh-CN).
  3. Open Quick Starts (Help menu or /quickstart).

Test cases:

  1. With language set to Chinese, Quick Starts catalog chrome strings are translated (for example "Filter by keyword..." → "按关键字过滤...", "Status" → "状态").
  2. Switch language English → Chinese and confirm chrome strings update without a full reload.
  3. Switch language Chinese → English and confirm chrome strings return to English.
  4. Spot-check another language (for example Japanese or Korean) still loads the correct Quick Starts chrome strings.
  5. Confirm dynamic plugin pages that use t() are unchanged.

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:


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/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jul 23, 2026
@openshift-ci
openshift-ci Bot requested review from sg00dwin and spadgett July 23, 2026 23:04
@openshift-ci openshift-ci Bot added the component/core Related to console core functionality label Jul 23, 2026
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Quick-start localization now derives language from i18n.resolvedLanguage and safely processes missing resource bundles as empty objects. Language-change handling applies the same logic before updating the quick-start resource bundle.

Changes

Resolved language and resource bundles

Layer / File(s) Summary
Resolve language and process resource bundles
frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx, frontend/packages/console-app/src/components/user-preferences/language/useLanguage.ts
Quick-start initialization and language-change handling use the resolved language, default missing resource bundles to {}, and process the resulting bundle before updating state.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: kind/i18n

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
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 commit only changes two non-test TSX files; no Ginkgo test titles were added or modified, and no test files changed.
Test Structure And Quality ✅ Passed PR changes only two frontend TSX files; no Ginkgo test code or *_test.go specs were modified.
Microshift Test Compatibility ✅ Passed Only two console-app TypeScript UI files changed; no new Ginkgo e2e tests, MicroShift checks, or unsupported OpenShift API/resource usage were added.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR only changes two frontend TypeScript hooks for i18n bundle lookup.
Topology-Aware Scheduling Compatibility ✅ Passed Only two frontend i18n hook files changed; no manifests/controllers/scheduling logic or topology constraints were introduced.
Ote Binary Stdout Contract ✅ Passed PASS: The patch only changes i18n bundle lookup; the touched files contain no stdout/logging calls in process-level code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo/e2e test files were added or changed; the PR only touches frontend i18n code and Jest/unit test files, with no IPv4 or external-network assumptions in new e2e tests.
No-Weak-Crypto ✅ Passed The PR only changes i18n bundle lookup; no weak crypto, custom crypto, or secret comparisons appear in the touched files.
Container-Privileges ✅ Passed Diff only changes i18n bundle lookup in two TSX/TS files; no container/K8s manifests or privilege settings were added or modified.
No-Sensitive-Data-In-Logs ✅ Passed No logging was added in the modified files; the PR only changes i18n bundle lookup and null-default handling.
Title check ✅ Passed The title names the Jira issue and clearly states the Quick Starts i18n bundle lookup fix for zh-CN.
Description check ✅ Passed All key sections are present with root cause, solution, screenshots, test plan, and extra notes; reviewer assignment is the main gap.
✨ 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 23, 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.

🧹 Nitpick comments (1)
frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx (1)

164-166: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for resolved-language bundle selection.

Cover zh-CN initialization, missing console-app bundles, and the corresponding language-change path so these two resource-loading implementations cannot drift.

🤖 Prompt for 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.

In
`@frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx`
around lines 164 - 166, Add regression tests around the resource-loading logic
using i18n initialization with resolvedLanguage set to zh-CN, including behavior
when the console-app bundle is missing. Also cover the language-change path and
assert both paths select and process the resolved-language bundle consistently;
keep the tests anchored to getProcessedResourceBundle and the surrounding
initialization/language-change handlers.
🤖 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.

Nitpick comments:
In
`@frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx`:
- Around line 164-166: Add regression tests around the resource-loading logic
using i18n initialization with resolvedLanguage set to zh-CN, including behavior
when the console-app bundle is missing. Also cover the language-change path and
assert both paths select and process the resolved-language bundle consistently;
keep the tests anchored to getProcessedResourceBundle and the surrounding
initialization/language-change handlers.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: d367294b-f70c-4139-a0db-bb0d00ebd7f5

📥 Commits

Reviewing files that changed from the base of the PR and between 9256a0c and 01526cc.

📒 Files selected for processing (2)
  • frontend/packages/console-app/src/components/quick-starts/utils/quick-start-context.tsx
  • frontend/packages/console-app/src/components/user-preferences/language/useLanguage.ts

@cajieh

cajieh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jul 23, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-74310, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yanpzhan

Details

In response to this:

/jira refresh

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

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

@openshift-ci-robot: GitHub didn't allow me to request PR reviews from the following users: yanpzhan.

Note that only openshift members and repo collaborators can review this PR, and authors cannot review their own PRs.

Details

In response to this:

@cajieh: This pull request references Jira Issue OCPBUGS-74310, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @yanpzhan

In response to this:

/jira refresh

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.

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.

@rhamilto

Copy link
Copy Markdown
Member

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jul 24, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-gcp-console
/test e2e-playwright

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cajieh, 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

@cajieh cajieh changed the title OCPBUGS-74310: Fix Quick Starts i18n bundle lookup for zh-CN OCPBUGS-33836: quickstart page i18n misses (Fix Quick Starts i18n bundle lookup for zh-CN) Jul 24, 2026
@openshift-ci-robot openshift-ci-robot added jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. and removed jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-33836, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Analysis / Root cause:
Quick Starts chrome strings (for example "Filter by keyword...", "Status") are not translated via t(). Console loads the full console-app resource bundle and passes it to PatternFly Quick Starts with i18n.getResourceBundle(language, 'console-app').

Language preference stores Chinese as zh-CN, but Console i18n is configured with load: 'languageOnly', so locale files are stored under zh. Looking up the bundle with zh-CN returned undefined, and PatternFly fell back to English. The rest of Console was unaffected because it uses t(), which resolves zh-CNzh correctly.

Related history: OCPBUGS-29365 / #13612 changed the preference value from zh to zh-CN, which exposed this Quick Starts lookup mismatch.

Solution description:
Use i18next's resolvedLanguage when loading the Quick Starts console-app resource bundle, with 'en' as a fallback:

  • quick-start-context.tsx — initial context values passed to PatternFly
  • useLanguage.tslanguageChanged handler that updates the bundle via setResourceBundle

resolvedLanguage is the language i18next actually resolved/loaded (for example zh when preference is zh-CN), which matches where resources are stored under load: 'languageOnly'. See https://www.i18next.com/overview/api#resolvedlanguage.

Also guard getResourceBundle with ?? {} so a missing bundle does not pass undefined into processing / PatternFly.

This does not change language preference storage, locale JSON files, or dynamic plugin i18n (plugins use their own plugin__* namespaces and t()).

Screenshots / screen recording:
Before:
e

After
f

Test setup:

  1. Log in to Console.
  2. Set User Preferences → Language → 中文 / Chinese (zh-CN).
  3. Open Quick Starts (Help menu or /quickstart).

Test cases:

  1. With language set to Chinese, Quick Starts catalog chrome strings are translated (for example "Filter by keyword..." → "按关键字过滤...", "Status" → "状态").
  2. Switch language English → Chinese and confirm chrome strings update without a full reload.
  3. Switch language Chinese → English and confirm chrome strings return to English.
  4. Spot-check another language (for example Japanese or Korean) still loads the correct Quick Starts chrome strings.
  5. Confirm dynamic plugin pages that use t() are unchanged.

Browser conformance:

  • Chrome
  • Firefox
  • Safari (or Epiphany on Linux)

Additional info:

Reviewers and assignees:



<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Bug Fixes**
 * Improved language detection when switching languages.
 * Prevented missing translation resources from causing issues in quick-start content.
 * Ensured quick-start translations remain available and process correctly, including pseudolocalization.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

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.

@cajieh

cajieh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-33836, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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.

@cajieh

cajieh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jul 24, 2026
@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jul 24, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@cajieh: This pull request references Jira Issue OCPBUGS-33836, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

No GitHub users were found matching the public email listed for the QA contact in Jira (yapei@redhat.com), skipping review request.

Details

In response to this:

/jira refresh

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.

@cajieh

cajieh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

/retest

@cajieh

cajieh commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

/test e2e-playwright

@openshift-ci

openshift-ci Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

@cajieh: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-playwright 01526cc link false /test e2e-playwright

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 jira/severity-low Referenced Jira bug's severity is low for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants