-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
✨ Feature Request: Fallback from LocalizedEnumTextAttribute → EnumTextAttribute
Overview
Provide a graceful fallback so that when a localized string is not found, the value from an accompanying
EnumTextAttribute is used instead.
This enables incremental migration from static enum labels to fully‑localized strings without breaking the UI.
Proposed Flow
- Localized string found → return it.
- Localized string missing
- Debug mode ON → return a diagnostic placeholder
[[Namespace.ResourceKey]] - Debug mode OFF →
- If the enum field has an
EnumTextAttribute, return itsText. - Otherwise fall back to the raw enum name.
- If the enum field has an
- Debug mode ON → return a diagnostic placeholder
┌───────────┐
│ Exists? │── Yes ──► return localized
└────┬──────┘
No
│
▼
┌───────────┐ debug?
│ Debug ON? │── Yes ──► [[ResourcePath::Key]]
└────┬──────┘
No
│
▼
┌────────────────────────────┐
│ EnumTextAttribute present? │── Yes ──► return EnumText.Text
└────┬───────────────────────┘
No
│
▼
return enum name
Benefits
- Incremental migration – keep existing EnumText values until resource strings are ready.
- No UI regressions – end‑users never see raw resource keys.
- Debug visibility – missing keys stand out in debug builds.
- Easy cleanup – once all keys are localized, remove obsolete EnumText attributes.
Implementation Notes
- Logic can live inside LocalizedEnumTextAttribute.GetLocalizedText() or a helper like Support.GetEnumDisplayText(...).
- Throw ArgumentException on ResourceUsage.None (consistent with other helpers).
- Add comprehensive unit tests covering:
- localized found
- debug placeholder
- EnumText fallback
- final enum‑name fallback.
Metadata
Metadata
Assignees
Labels
No labels