Skip to content

iOS gap detail shows the raw subcategory name instead of the localized string #53

Description

@jvsena42

GapsScreen.swift renders the subcategory of a gap recommendation by humanizing the raw enum name, instead of looking up the subcategory_* localized key like every other iOS call site.

iosApp/iosApp/Screens/GapsScreen.swift:350:

if let sub = recommendation.subcategory {
    detailRow(String(localized: "label_subcategory"), sub.name.lowercased().replacingOccurrences(of: "_", with: " ").capitalized)
}

Compare with AddItemSheet.swift:458-461 and ItemDetailSheet.swift:223-226, which both do:

let key = "subcategory_\(subcategory.name.lowercased())"
return String(localized: String.LocalizationValue(key))

Consequence: the gap detail row is never translated. In pt-BR the app shows "Boots Chelsea" instead of "Bota chelsea", "Hat Cap" instead of "Boné", "Bag Backpack" instead of "Mochila". It also leaks the enum's internal wording (HAT_CAP → "Hat Cap") into the UI even in English. Android's GapsScreen.kt:519-520 already uses it.displayName() and is correct, so the two platforms disagree.

Suggested fix

  • Reuse the localized lookup. The helper is currently duplicated verbatim in AddItemSheet.swift and ItemDetailSheet.swift — worth extracting it to a single place (e.g. a Subcategory extension in Components/) and calling it from all three screens.

Noticed while fixing #51.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions