You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update e2e tests to support German locale in the RHDH repo
Update e2e tests to support Spanish locale in the RHDH repo
Non-compliant requirements:
Requires further human verification:
Verify German and Spanish localization Playwright projects run successfully in CI/nightly against a deployed RHDH instance
Verify translated UI strings used by the updated tests (for Admin > Extensions, Docs sidebar, Settings language selector) are actually present in the running app for de/es
A RegExp is built directly from a translation string for a role/name lookup. If the translation contains regex metacharacters (e.g., (, ), ., ?, +, *, [, ], |) it can change the meaning of the regex and cause false positives/negatives or runtime failures. Consider escaping the translation string before constructing the regex, or use exact string matching when possible.
The merge logic assumes each imported translation JSON matches Record<namespace, Record<lang, Record<key, string>>>. If any of the newly added de/es translation files have a different shape (missing the language nesting, or different nesting depth), the merge will silently produce empty objects (due to optional chaining and fallbacks) and tests may pass with English fallbacks rather than actually validating localized content. It may be worth adding a lightweight runtime validation/assertion for expected structure per locale/namespace to catch malformed translation files early.
constde={
...deBackstage,
...deCommunityPluginsBase,
...deRhdh,
...deCommunityPlugins,
...deRhdhPlugins,};constes={
...esBackstage,
...esCommunityPluginsBase,
...esRhdh,
...esCommunityPlugins,
...esRhdhPlugins,};constfr={
...frBackstage,
...frCommunityPluginsBase,
...frRhdh,
...frCommunityPlugins,
...frRhdhPlugins,};constit={
...itBackstage,
...itCommunityPluginsBase,
...itRhdh,
...itCommunityPlugins,
...itRhdhPlugins,};constja={
...jaBackstage,
...jaCommunityPluginsBase,
...jaRhdh,
...jaCommunityPlugins,
...jaRhdhPlugins,};exporttypeLocale="de"|"en"|"es"|"fr"|"it"|"ja";typeTranslationFile=Record<string,Record<string,Record<string,string>>>;/** * Merge translations with English fallback. * For each namespace, if a locale doesn't have translations, fall back to English. */functioncreateMergedTranslations(){constallNamespaces=newSet([
...Object.keys(en),
...Object.keys(de),
...Object.keys(es),
...Object.keys(fr),
...Object.keys(it),
...Object.keys(ja),]);constmerged: Record<string,Record<string,Record<string,string>>>={};for(constnamespaceofallNamespaces){constenKeys=(enasTranslationFile)[namespace]?.en||{};merged[namespace]={en: enKeys,de: { ...enKeys, ...((deasTranslationFile)[namespace]?.de||{})},es: { ...enKeys, ...((esasTranslationFile)[namespace]?.es||{})},fr: { ...enKeys, ...((frasTranslationFile)[namespace]?.fr||{})},it: { ...enKeys, ...((itasTranslationFile)[namespace]?.it||{})},ja: { ...enKeys, ...((jaasTranslationFile)[namespace]?.ja||{})},
The test now navigates to the Extensions page via a translated sidebar label (t["plugin.extensions"][lang]["header.title"]) instead of the previous hardcoded Extensions fallback. Validate that the sidebar item is actually translated and stable in all locales (especially in CI), otherwise this change can reintroduce the navigation failure that the previous workaround was avoiding. (Ref 6)
Reference reasoning: The existing test implementation explicitly avoided using the translated label and used openSidebar("Extensions") with a tracked TODO about broken/unstable behavior. Removing that fallback changes the navigation strategy back to the path that was previously documented as problematic, so this should be re-verified across environments/locales before merging.
Add complete German translation file for RHDH plugins
translations/test/rhdh-plugins-de.json
Added comprehensive German translation file with 1092 lines of translated strings for multiple plugins
Includes translations for adoption-insights, ai-experience, bulk-import, global-floating-action-button, global-header, dynamic-home-page, lightspeed, extensions, orchestrator, quickstart, scorecard, and other plugins
Replace hardcoded English strings in verifyHeading and verifyText calls with translated values from the t object to ensure localization tests pass for all languages.
-await uiHelper.verifyHeading("Documentation");-await uiHelper.verifyText("Documentation available in", false);+await uiHelper.verifyHeading(t["rhdh"][lang]["menuItem.docs"]);+await uiHelper.verifyText(t["rhdh"][lang]["docs.availableIn"], false);
Apply / Chat
Suggestion importance[1-10]: 9
__
Why: The suggestion fixes a clear bug where hardcoded English strings are used for verification in a localization test, which would cause failures for other locales and defeats the purpose of the test.
High
Fix locale-sensitive ordered snapshot assertion
Replace the order-sensitive toMatchAriaSnapshot assertion with individual checks for each listbox option to prevent test failures caused by locale-dependent ordering.
Why: The suggestion correctly identifies that the toMatchAriaSnapshot assertion is order-dependent and will likely fail when tests are run under different locales, making the proposed order-agnostic check a crucial improvement for test robustness.
Medium
Fix incorrect pluralization logic
Correct the identical translations for the singular and plural versions of permissions.missingPermissionDescription to ensure grammatical correctness in German.
-"permissions.missingPermissionDescription": "Um die Topologie anzuzeigen, muss Ihr Administrator Ihnen {{permissions}} {{permissionText}} erteilen.",-"permissions.missingPermissionDescription_plural": "Um die Topologie anzuzeigen, muss Ihr Administrator Ihnen {{permissions}} {{permissionText}} erteilen.",+"permissions.missingPermissionDescription": "Um die Topologie anzuzeigen, muss Ihr Administrator Ihnen die Berechtigung {{permissions}} erteilen.",+"permissions.missingPermissionDescription_plural": "Um die Topologie anzuzeigen, muss Ihr Administrator Ihnen die Berechtigungen {{permissions}} erteilen.",
Apply / Chat
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly identifies a grammatical error where singular and plural forms have identical translations, and the proposed change fixes the issue, improving localization quality.
Low
Use cross-env for env variables
Prefix environment variable assignments in npm scripts with cross-env to ensure they are compatible with Windows environments.
-"showcase-localization-de": "LOCALE=de playwright test --project=showcase-localization-de",-"showcase-localization-es": "LOCALE=es playwright test --project=showcase-localization-es",+"showcase-localization-de": "cross-env LOCALE=de playwright test --project=showcase-localization-de",+"showcase-localization-es": "cross-env LOCALE=es playwright test --project=showcase-localization-es",
Apply / Chat
Suggestion importance[1-10]: 6
__
Why: This suggestion correctly points out a cross-platform compatibility issue in the npm scripts and proposes the standard solution, cross-env, to ensure they run on Windows.
Low
Remove placeholder text from translation
Remove the "Lorem" placeholder text from the formatting.intlRelativeTimeWithOptionsExplicit translation string.
Why: The suggestion correctly identifies and proposes the removal of "Lorem" placeholder text from a translation string, which is an unprofessional artifact that should not be displayed to users.
Low
High-level
Automate localization test configuration generation
Refactor the E2E test setup to programmatically generate localization configurations from a single list of locales. This will simplify adding new languages and improve maintainability by removing manual duplication across multiple files.
// e2e-tests/playwright.config.tsif(args.some((arg)=>arg.includes('showcase-localization-de'))){process.env.LOCALE="de";}elseif(args.some((arg)=>arg.includes('showcase-localization-es'))){process.env.LOCALE="es";}elseif(args.some((arg)=>arg.includes('showcase-localization-fr'))){process.env.LOCALE="fr";}// ... and so on for other localesexportdefaultdefineConfig({projects: [// ... other projects{name: 'showcase-localization-de',use: {locale: "de"},testMatch: [/* ... test files ... */],},{name: 'showcase-localization-es',use: {locale: "es"},testMatch: [/* ... test files ... */],},// ... more duplicated project configs for fr, it, ja],});
After:
// e2e-tests/playwright.config.tsconstLOCALES=["de","es","fr","it","ja"];constcommonTestMatch=[/* ... test files ... */];// Simplified logic to set LOCALEconstlocaleArg=args.find(arg=>LOCALES.some(l=>arg.includes(`showcase-localization-${l}`)));if(localeArg){process.env.LOCALE=localeArg.split('-').pop();}constlocalizationProjects=LOCALES.map(locale=>({name: `showcase-localization-${locale}`,use: {locale: locale},testMatch: commonTestMatch,}));exportdefaultdefineConfig({projects: [// ... other projects
...localizationProjects,],});
Suggestion importance[1-10]: 8
__
Why: The suggestion correctly identifies a scalability issue with manually adding new locales and proposes a valid architectural improvement to automate configuration generation, which would significantly enhance maintainability.
Medium
General
Prevent partial string match for locale detection
Replace arg.includes() with an exact match (e.g., arg === PW_PROJECT.SHOWCASE_LOCALIZATION_DE) to prevent incorrect locale detection from partial string matches in command-line arguments.
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 6
__
Why: The suggestion correctly points out that using arg.includes() for locale detection is not robust and could lead to incorrect partial matches; switching to an exact match improves the reliability of the configuration script.
Low
Add default locale fallback
Add a final else block to the locale detection logic to set a default locale (e.g., "en"), ensuring process.env.LOCALE is always defined.
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 5
__
Why: The suggestion improves the script's robustness by adding a default fallback for process.env.LOCALE, preventing it from being undefined when no specific locale flag is provided.
Low
Translate hardcoded English string
Translate the value for appStatus.appSyncStatus.OutOfSync from "OutOfSync" to its German equivalent to ensure a fully localized UI.
Why: The suggestion correctly identifies an untranslated string in the German translation file, which would result in a mixed-language user interface.
Low
Use exact name match
Use the { exact: true } option in the getByRole selector instead of a RegExp for a cleaner and safer way to perform an exact name match with translated strings.
Why: The suggestion offers a cleaner, more idiomatic Playwright approach by using { exact: true } instead of a regex, which improves code readability and avoids potential regex escaping issues with translated strings.
Low
Remove leading newlines from translation
Remove the leading newline characters (\n\n) from the dialog.exitWarning translation string to separate presentation concerns from the content.
-"dialog.exitWarning": "\n\nAl salir de esta página, se descartará la información ingresada de forma permanente. ¿Confirma que desea salir?",+"dialog.exitWarning": "Al salir de esta página, se descartará la información ingresada de forma permanente. ¿Confirma que desea salir?",
Apply / Chat
Suggestion importance[1-10]: 4
__
Why: The suggestion correctly identifies leading newline characters in a translation string, which is poor practice and could cause minor UI layout issues.
Low
Remove empty translation block
Remove the empty plugin.tekton.es translation block to prevent potential localization lookup failures.
Why: The suggestion correctly identifies an empty translation object which could cause runtime issues and should be removed for code cleanliness and safety.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adding de and es locales to e2e tests
Which issue(s) does this PR fix
PR acceptance criteria
Please make sure that the following steps are complete:
How to test changes / Special notes to the reviewer