I need to localize often the same phrases like "No ads" in different apps. Is there any way to add words/phrases that I often localize so that Xcode localize them automatically?
CodePudding user response:
Use the function
func NSLocalizedString(
key: String,
tableName: String? = default,
bundle: NSBundle = default,
value: String = default,
comment: String) -> String
In your project create a strings file with same format as default one (Localizable.strings). Then you can add the localisation for different languages.
To use it (assume the file name in your bundle is myCommonsStrings.strings :
let noAdd = NSLocalizedString(key: "NoAdd",
tableName: "myCommonsStrings",
comment: "No add string”)