Change the development area in the projectplisttoenand that’s it
CFBundleDevelopmentRegionen
Apple’s multi-language principle
Introduction to nouns Localizable.stringsMulti-language file, used to localize the strings in the AppLocalizable.strings多语言文件,用于本地化App内的字符串 InfoPlist.strings多语言文件,用于本地化App名称 Base多语言默认文件,被其它多语言 (Chinese, English, ...) 继承和覆盖,不会被iOS直接使用,只有当对应的多语言文件中没有找到相应条目时才会到BaseInfoPlist.stringsMulti-language file, used to localize the App name
Base The multi-language default file is inherited and overridden by other multi-languages (Chinese, English, ...) and will not be used directly by iOS. It will only be used when the corresponding entry is not found in the corresponding multi-language file. It will search in
Base, which is similar to the default value of function parameters.
Search principle WhenAppis started,iOSwill traverse the language priority set by the user to match the multi-language files ofApp
If it matches, the corresponding language will be usedIf it does not match, it will useplist
The language corresponding to the development area
The internationalization of iOS has always been very troublesome to deal with, and I have always wanted to find a more perfect solution to solve the internationalization problem. I shared an article that was too international before, and now I will analyze it in depth. Because the article was written before. The original article has been updated. Will be updated at the end. 1. Problems 1. The official has not given a perfect way to deal with internationalization. 2. You cannot specify other languages to display when this language is not adapted. It will default to the last language selected. 3. After a major version update, the data update is not compatible with the previous version. 4. Adding a specific language resource file does not correspond to the language returned by the code.
2. Internationalization framework idea
In response to the above problems, I enabled a plist to handle internationalization issues. The key and value in the plist correspond to each other. If the current language is obtained and corresponds to the plist, the current language will be displayed, otherwise the specified language will be displayed.
3. Implementation method Add the corresponding language package based on a specific language. Use NSLocalizedString to get the corresponding language. Get current language
s is the current language that is not Chinese or English. Currently, English can be removed, because whether to judge English or not, it must be processed into English. Displayed as follows
Change the development area in the projectplistto
More introductionen
and that’s itHello, just use the
DPLocalizedString
方法代替系统的NSLocalizedString
I provided.Hello, I will provide you with an idea. The specific implementation may need to be done by yourself according to your needs.
Get the machine default language
2. Determine the language
The internationalization of iOS has always been very troublesome to deal with, and I have always wanted to find a more perfect solution to solve the internationalization problem. I shared an article that was too international before, and now I will analyze it in depth.
Because the article was written before. The original article has been updated. Will be updated at the end.
1. Problems
1. The official has not given a perfect way to deal with internationalization.
2. You cannot specify other languages to display when this language is not adapted. It will default to the last language selected.
3. After a major version update, the data update is not compatible with the previous version.
4. Adding a specific language resource file does not correspond to the language returned by the code.
2. Internationalization framework idea
In response to the above problems, I enabled a plist to handle internationalization issues.
The key and value in the plist correspond to each other. If the current language is obtained and corresponds to the plist, the current language will be displayed, otherwise the specified language will be displayed.
3. Implementation method
Add the corresponding language package based on a specific language. Use NSLocalizedString to get the corresponding language.
Get current language
Determine whether the current language is the language to be adapted
s is the current language that is not Chinese or English. Currently, English can be removed, because whether to judge English or not, it must be processed into English. Displayed as follows
Article link
There are some notes in my notes about summarizing international content.