skip icon indicating copy to clipboard operation
skip copied to clipboard

Bridge `String(localized:bundle:)`

Open piercifani opened this issue 1 month ago • 1 comments

Currently, String(localized:table:bundle:locale:comment:) is not bridged and we most fallback to NSLocalizedString.

It would be a nice addition to reduce the amount of changes needed to port existing iOS codebases.

piercifani avatar Nov 13 '25 13:11 piercifani

Note that for the short term, you could implement it yourself and forward the calls to NSLocalizedString. At least that way when we eventually implement String(localized:), you could just be able to remove your per-module override.

E.g.,

#if os(Android)
extension String {
    init(localized: String, bundle: Bundle, comment: String) {
        self = NSLocalizedString(…)
    }
}
#endif

marcprux avatar Nov 14 '25 03:11 marcprux