If the app is going to be internationalized in the future, for example, China needs to use it, the United States needs to consider the app to support multiple languages
The specific way is as follows
First, create a new Strings in supporting files
Named: Localizable
Start configuration
If the language you want to choose is missing from the point-in-turn option
For example, if you need to select French, you can add the following ways
After the configuration is complete we go back to the newly created localizable.strings open and find the file that generated the corresponding language
Our example adds only Simplified Chinese English and then adds the string separately
"Test" = "testing";
"Test" = "test";
Use the following method
Gets the current system language setting nsuserdefaults *defaults = [Nsuserdefaults standarduserdefaults]; Nsarray *languages = [Defaults objectforkey:@ "Applelanguages"]; NSString *currentlanguage = [languages objectatindex:0]; NSLog (@ "%@", currentlanguage); Set the user language to the current system language [Defaults setobject:currentlanguage forkey:@ "user_lang_string"]; You can use Nslocalizedstring to invoke. nsstring *strtest = nslocalizedstring (@ "Test", @ ""); Test button UIButton *registbtn=[uibutton Buttonwithtype:uibuttontypesystem]; Registbtn.frame=cgrectmake (a); [Registbtn settitle:strtest forstate:uicontrolstatenormal];//the use of strtest here will be automatically identified according to the phone system language [Self.view addsubview : REGISTBTN];
The text of the button in the example is automatically recognized by the system language
If there is a problem can add QQ discussion
Apple Development Group: 414319235 Welcome to Join
IOS Multi-language support