Generate webHtmlApp's strings, collapse a redundant string key
Strings.kt is now generated at build time (:webHtmlApp:generateStrings, in webHtmlApp/build.gradle.kts) by parsing shared's strings.xml directly, rather than a hand-maintained duplicate that could silently drift from it. Names are mechanical camelCase of the XML key, so a few call sites got more verbose (e.g. moveUp -> moveCurrencyUpContentDescription) in exchange for zero manual sync. Only covers the base English locale. Also collapses currency_option_label_local into currency_option_label: the two had identical English text and existed only as a hook for a future translation to phrase the user's own currency differently, which no locale currently does. Removes the info.code == localeCurrencyCode branching (and the now-pointless localeCurrencyCode parameter/field) from all three UI implementations - PriceScreen.kt, CurrencyPickerSheet.swift, and HtmlCurrencyPicker.kt - plus IosConverterState.localeCurrencyCode, which existed solely to feed that branch on the Swift side. Fixes a real regression surfaced while verifying the above by actually building the Xcode project (not done since currencyFlagEmoji() gained its supportsFlagEmoji parameter): Kotlin/Native doesn't generate default-parameter overloads for Swift/ObjC-exported functions, so both Swift call sites needed the argument passed explicitly, via the correct exported facade name for an expect/actual pair - the actual file's (SystemCurrencies_appleKt), not the common one (SystemCurrenciesKt). Also drops "(DOM)" from webHtmlApp's page title. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -274,7 +274,6 @@ struct ContentView: View {
|
||||
unselectedCurrencies: state.unselectedCurrencies,
|
||||
pricedCurrencyCodes: state.pricedCurrencyCodes,
|
||||
sourceName: state.sourceName,
|
||||
localeCurrencyCode: state.localeCurrencyCode,
|
||||
selectedCount: state.selectedCurrencyCodes.count,
|
||||
onToggle: { viewModel.onFiatCurrencyToggled($0) },
|
||||
onReset: { viewModel.onSelectedCurrenciesReset() }
|
||||
@@ -404,7 +403,7 @@ private struct NumericField: View {
|
||||
}
|
||||
|
||||
private func currencyFieldLabel(for code: String) -> String {
|
||||
if let flag = CurrencyFlagKt.currencyFlagEmoji(code: code) {
|
||||
if let flag = CurrencyFlagKt.currencyFlagEmoji(code: code, supportsFlagEmoji: SystemCurrencies_appleKt.supportsFlagEmoji()) {
|
||||
return "\(flag) \(code)"
|
||||
}
|
||||
return code
|
||||
|
||||
@@ -7,7 +7,6 @@ struct CurrencyPickerSheet: View {
|
||||
let unselectedCurrencies: [CurrencyInfo]
|
||||
let pricedCurrencyCodes: [String]
|
||||
let sourceName: String
|
||||
let localeCurrencyCode: String?
|
||||
let selectedCount: Int
|
||||
let onToggle: (String) -> Void
|
||||
let onReset: () -> Void
|
||||
@@ -142,19 +141,11 @@ struct CurrencyPickerSheet: View {
|
||||
}
|
||||
|
||||
private func currencyLabel(for info: CurrencyInfo) -> String {
|
||||
let text: String
|
||||
if info.code == localeCurrencyCode {
|
||||
text = IosLocalizationKt.localizedFormattedString(
|
||||
resource: MR.strings.shared.currency_option_label_local,
|
||||
args: [info.code, info.displayName]
|
||||
)
|
||||
} else {
|
||||
text = IosLocalizationKt.localizedFormattedString(
|
||||
resource: MR.strings.shared.currency_option_label,
|
||||
args: [info.code, info.displayName]
|
||||
)
|
||||
}
|
||||
if let flag = CurrencyFlagKt.currencyFlagEmoji(code: info.code) {
|
||||
let text = IosLocalizationKt.localizedFormattedString(
|
||||
resource: MR.strings.shared.currency_option_label,
|
||||
args: [info.code, info.displayName]
|
||||
)
|
||||
if let flag = CurrencyFlagKt.currencyFlagEmoji(code: info.code, supportsFlagEmoji: SystemCurrencies_appleKt.supportsFlagEmoji()) {
|
||||
return "\(flag) \(text)"
|
||||
}
|
||||
return text
|
||||
|
||||
Reference in New Issue
Block a user