fix(styles): resolve style captions through in-app language
Style card descriptions were passed to Text as raw String keys, so they never went through AppL10n. Resolve them (and the editor title) with the in-app UI language override, matching the rest of the host app. Co-authored-by: Rocky <hkgood@users.noreply.github.com>
This commit is contained in:
@@ -196,9 +196,11 @@ struct PersonalReplyStyleSection: View {
|
||||
Image(systemName: "arrow.clockwise")
|
||||
}
|
||||
Text(
|
||||
isGenerating
|
||||
? "personalReplyStyle.regenerating"
|
||||
: "personalReplyStyle.regenerate"
|
||||
AppL10n.string(
|
||||
isGenerating
|
||||
? "personalReplyStyle.regenerating"
|
||||
: "personalReplyStyle.regenerate"
|
||||
)
|
||||
)
|
||||
}
|
||||
.font(TypeStyle.bodyEmph)
|
||||
|
||||
@@ -169,7 +169,10 @@ struct PolishStylesView: View {
|
||||
.foregroundStyle(palette.textPrimary)
|
||||
.lineLimit(1)
|
||||
.padding(.trailing, 32)
|
||||
Text(descriptionKey(for: pack))
|
||||
// AppL10n honors Settings → App Language; Text(String) would
|
||||
// show the raw key, and a bare LocalizedStringKey would follow
|
||||
// the system language instead (see Scripts/check_l10n_keys.sh).
|
||||
Text(AppL10n.string(descriptionKey(for: pack), language: config.uiLanguage))
|
||||
.font(TypeStyle.caption2)
|
||||
.foregroundStyle(palette.textTertiary)
|
||||
.lineLimit(2)
|
||||
@@ -229,19 +232,11 @@ struct PolishStylesView: View {
|
||||
}
|
||||
}
|
||||
|
||||
/// Host-bundle caption keys. Resolved at the render site with `AppL10n`
|
||||
/// so Settings → App Language wins over the launch-time system locale.
|
||||
private func descriptionKey(for pack: PolishStylePack) -> String {
|
||||
guard pack.kind == .builtin else { return "polishStyles.custom.description" }
|
||||
switch pack.id {
|
||||
case "builtin.structured": return "polishStyles.structured.description"
|
||||
case "builtin.formal": return "polishStyles.formal.description"
|
||||
case "builtin.dating": return "polishStyles.dating.description"
|
||||
case "builtin.chat": return "polishStyles.chat.description"
|
||||
case "builtin.flex": return "polishStyles.flex.description"
|
||||
case "builtin.corp": return "polishStyles.corp.description"
|
||||
case "builtin.diba": return "polishStyles.diba.description"
|
||||
case "builtin.xhs": return "polishStyles.xhs.description"
|
||||
default: return "polishStyles.light.description"
|
||||
}
|
||||
return "polishStyles.\(pack.id.dropFirst("builtin.".count)).description"
|
||||
}
|
||||
|
||||
private func reload() {
|
||||
@@ -464,7 +459,9 @@ struct PolishStyleEditorSheet: View {
|
||||
Text(AppL10n.string("polishStyles.editor.hint"))
|
||||
}
|
||||
}
|
||||
.navigationTitle(isNew ? "polishStyles.add" : "polishStyles.edit")
|
||||
.navigationTitle(
|
||||
AppL10n.string(isNew ? "polishStyles.add" : "polishStyles.edit")
|
||||
)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
|
||||
Reference in New Issue
Block a user