iOS internationalization: How to switch Languages 1, internationalization is to put tags, information and other information into the resource file, with the language required by the program to provide the corresponding resource files. With Key/value storage, the key value of each resource is constant, and value changes with the demand. The general change is to write "dead" things, network requests can not be changed. 2. Add multiple languages: New Project (internationalization)--International-->project-->info-->localizations--> "+" Chinese (Simplified)
--Finish:
3. Create Infoplist.strings: Modify the project name Language Cmd+n (new)-->resource--> strings File-->next
--Named Infoplist.strings--> creates-->finish Add properties: Click Infoplist.strings--> Right Locatize--> locatize-- > Cancel base, Tick Chinese, chinses (Simplified):--> Click on the left infoplist.strings lower triangle to add properties: Infoplist.string (中文版) Inside input: Cfbundledisplayname = "localizable"; infoplist.string (Chinese (Simplified)) input: Cfbundledisplayname = "internationalization"; At this time: the name of the project to the internationalization (Chinese), the corresponding English changed to: Localizable 4. Similarly create localizable.strings (step with 3): Modify the label display language in Localizable.strings (simplified Write down: "LabelText" = "Simplified Chinese"; Localizable.strings (English): "LabelText" = "It is Chinese"; Create a LabelText (Label object) in the VC:
UILabel *label = [[UILabel alloc]initwithframe:cgrectmake (100, 100, 175, 50)];
Label.backgroundcolor = [Uicolor Graycolor];
Label.text = nslocalizedstring (@ "LabelText", nil);
[Self.view Addsubview:label];
The results are as follows:
Get all languages and the current language:
IOS-International language switching