Now the development of the project will inevitably encounter the internationalization of processing, the following I understand the internationalization of relevant knowledge points summarized
1 First name the project name, systematic text, such as the name of the program
1. Add language to the project first
2 Add a infoplist.strings file
3. Convert Info.plist to regular key
4, Configuration Infoplist.strings
5 This is done, the name changes after you switch the system language.
--------------------------------------------------------------------------------------------------------------- -----------------------
--------------------------------------------------------------------------------------------------------------- ----------------------
Configure a general internationalization configuration file
1 Add a Localizable.strings file, and then the same action as above, and then in the corresponding different files set different key value
2 and then in the project according to different languages to get the name of the non-pass
Nslocalizedstring (@ "titlename", nil)
This enables the project to be multi-lingual
If you need to switch languages you only need to set the language
// "Zh-hans-us", Chinese // ////Set language Nsarray *lans = @[@ "en-us" ]; [[Nsuserdefaults Standarduserdefaults] Setobject:lans forkey: @" applelanguages "];
The project often encounters multi-person development may involve everyone to modify localizable.strings this will be handled poorly may conflict then you can create a strings definition yourself ****.strings
Then, when acquiring the internationalized name, you only need to specify which of the. Strings table gets the line code as follows
Self.bb.text=nslocalizedstringfromtable (@"TitleName"@ "Mine" , nil);
----------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
Image internationalization Configuration
1 Drag a picture into the project directory, not drag into the Assets.xcassets
Then the same as before, and then look at the table of contents to replace the pictures in the different languages can be adapted to the picture
Then use the code to get a different picture.
NSString *imagename = nslocalizedstring (@ "doctor_start_10", nil); *image = [UIImage imagenamed:imagename]; Self.img.image=image;
International adaptation complete
iOS Project internationalization