Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift use unicode character in localization.strings

I am trying to put a unicode character inside my localization.strings file. When I manually set a label's text to "\u{F071}", the character appears properly. When I have that character as part of a string within the localization file, then the unicode character does not appear like I want it. Is there some encoding setting that I might be missing? Or should we not have unicode characters within the localization file?

like image 811
Mike Walker Avatar asked Apr 14 '15 15:04

Mike Walker


People also ask

How do you localize a string in Swift?

string file, select it and on the File Inspector (right menu) select “Localize”. Select your the new language you added and click on “Finish”. If you select the file again you should see something similar to the first image below (be sure to select both the supported languages).

Why do we use Unicode strings?

Unicode is a standard encoding system that is used to represent characters from almost all languages. Every Unicode character is encoded using a unique integer code point between 0 and 0x10FFFF . A Unicode string is a sequence of zero or more code points.

Which of the following actions forms a new string by joining strings or characters in Swift?

Concatenate Using + and += We can also use the + and += operators to concatenate two strings. In the above example, we have used the + and += operators to join two strings: greet and name . Note: We cannot create greet using let . It is because the += operator joins two strings and assigns the new value to greet .

What is localized string?

There are two categories of localized strings: the strings included in the installation package's UI, common to every MSI file. the strings included in your project, that are particular to the current project: the name of your application, file names, registry values, properties etc.


1 Answers

You have to follow localization.strings's unicode format, e.g.:

"your-key" = "\UF071";
like image 180
Bill Chan Avatar answered Oct 14 '22 13:10

Bill Chan