How to add Unicode escape sequence in Localizable.strings?

803 views Asked by At

How can a Unicode escape sequence be added to a string in Localizeable.strings file if the string is casted to NSString?

Here is one (ugly) example:

// Localized string: "\u{200F}Number %@" = "\u{200E}Number %@";

let string = NSMutableAttributedString(string: NSString(format: NSLocalizedString("Number %@", comment: "") as NSString, aNumber as NSNumber)) as String

From this question I understand that the problem is the incompatible escape sequences of Localizeable.strings and NSString.

Adding the unicode characters directly is Localizeable.strings file is not an option because I need to insert bidirectional semantics markers that are not printable characters. They would also be lost in most translation programs.

How can I work around that?

0

There are 0 answers