fix(core): Localize default collection filter names#4915
Conversation
The default collection-filter ConfigurableOperationDef labels and descriptions in default-collection-filters.ts were English-only. These strings are served to the Dashboard via the collectionFilters query and resolved server-side by languageCode, so the collection-filter dropdown names and arg labels never translated (the server-side half of OSS-405). Add translations for the 9 short user-facing strings across the 26 locales the Dashboard ships. The two long arg-tooltip descriptions are left in English (they would exceed the eslint max-len limit in verbose languages); tracked as a follow-up. Note: collection filters are intentionally the only configurable operation localized inline here; a broader extraction of all such strings to lingui catalogs is proposed separately in OSS-560. Relates to OSS-449
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR updates Changes
Possibly related issues
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Localizes the default collection-filter names shown in the Dashboard. The collection-filter
ConfigurableOperationDeflabels/descriptions in@vendure/corewere English-only, so the "Add collection filter" dropdown options and the arg labels inside a filter card stayed in English even when the Dashboard UI language was switched.This is the server-side complement to OSS-405 (#4410): that PR fixed the dashboard-owned strings, but the filter names/labels are served by core via the
collectionFiltersquery and resolved server-side bylanguageCode, so they can only be translated here.Root cause
In
packages/core/src/config/catalog/default-collection-filters.ts, the user-facinglabel/descriptionfields areLocalizedString[]that only definedLanguageCode.en. When the dashboard requestscollectionFilterswith e.g.languageCode: de, the resolver falls back to the English value.Change
Expanded the 9 short user-facing strings to include the 26 locales the Dashboard ships (en + de, es, fr, it, nl, pt_BR, pt_PT, cs, pl, ro, hr, hu, nb, sv, tr, uz, ru, bg, uk, ar, fa, he, ja, ne, zh_Hans, zh_Hant):
The
apply()query-builder logic is untouched.Scope notes
combineWithAnd,containsAny) are intentionally left English-only: translated, they exceed the eslintmax-len(170) in verbose languages after prettier reformatting, which would require a// eslint-disableper line. Tracked as a follow-up. (Result: adeuser sees a German label with an English hover tooltip on those two args.)Test plan
tscondefault-collection-filters.ts: no errors; all 26 codes are validLanguageCodemembers.LocalizedStringentries) only.Relates to OSS-449. Complements #4410 (OSS-405).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.