Sunday, November 8, 2026
HomeiOS Developmentios - Localizable.strings & prefix operator

ios – Localizable.strings & prefix operator

[ad_1]

Making an attempt to make including localized strings a bit simpler:

prefix func § (string: String) -> String {
   return NSLocalizedString(string, remark: "")
}

Utilizing it like this:

let hey = §"hello_string"

Whereas this works nice when manually including these strings to Localizable.strings, they aren’t robotically added with “Export Localizations” anymore. Additionally tried the next approaches which appear to have the identical problem:

  1. https://stackoverflow.com/a/56445894/14542345
  2. Localized string with argument provides line breaks and brackets round argument

Is there a means round this? Or is the one resolution to make use of NSLocalizedString("hello_string", remark: "")?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments