IPhone development: app Localization: iPhone development: app Localization

Source: Internet
Author: User
Bytes

1. Right-click localizables in the Custom Resources Directory, select new file,

Select the strings file of the resource.

Click Next. The file name is defined as "localizable. Strings". Select the directory you want to save and create

2. Select the localizable. Strings file.

On the tool panel on the right, click "+" to add English and Chinese, respectively,

The directory structure on the left is changed

The corresponding directory will generate two corresponding English EN. lproj and Chinese zh-Hans.lproj directory, and the corresponding localizable. Strings File

As follows:

3. Localization

Localizable. Strings uses the key-Value Pair list method to localize applicationsProgramData

Format:

 
"Key" = "value ";

Enter the colon (:) and equal sign (=). When the score is good, the values must be in English.

For example:

Write in the localizable. Strings (English) File

"Testkey" = "test ";

Write in the localizable. Strings (Chinese) File

 
"Testkey" = "test ";

When using nslocalizedstring, you only need to call the system macro nslocalizedstring to set irrelevant string data using language.

Format:Nslocalizedstring (@ "key", nil)

For example:

 
Label. Text = nslocalizedstring (@ "testkey", @ "is test ");

The first parameter of nslocalizedstring is the corresponding key name, and the second parameter is a custom description. You can use Nil

 

4. localized application names

Edit info. plist and add the application has localized display name. Set the value to yes.

If the program automatically generatesInfoplist. Strings file. If no file exists, create one and perform steps 1 and 2.

Cfbundledisplayname values are defined in infoplist. Strings (English) and infoplist. Strings (Chinese) respectively.

 
"Cfbundledisplayname" = "app name ";
 
"Cfbundledisplayname" = "app name ";

Set the default value to Chinese: Edit info. plist, add the localization Native Development Region item, and set it to China.

 

5. The image is similar to the XIB file localization, you can also add the Same Name image file and XIB file in the corresponding en. lproj and zh-Hans.lproj directory

Add files to the project list

1. Right-click localizables in the Custom Resources Directory, select new file,

Select the strings file of the resource.

Click Next. The file name is defined as "localizable. Strings". Select the directory you want to save and create

2. Select the localizable. Strings file.

On the tool panel on the right, click "+" to add English and Chinese, respectively,

The directory structure on the left is changed

The corresponding directory will generate two corresponding English EN. lproj and Chinese zh-Hans.lproj directory, and the corresponding localizable. Strings File

As follows:

3. Localization

Localizable. Strings uses a key-Value Pair list to localize Application Data

Format:

 
"Key" = "value ";

Enter the colon (:) and equal sign (=). When the score is good, the values must be in English.

For example:

Write in the localizable. Strings (English) File

 
"Testkey" = "test ";

Write in the localizable. Strings (Chinese) File

 
"Testkey" = "test ";

When using nslocalizedstring, you only need to call the system macro nslocalizedstring to set irrelevant string data using language.

Format:Nslocalizedstring (@ "key", nil)

For example:

 
Label. Text = nslocalizedstring (@ "testkey", @ "is test ");

The first parameter of nslocalizedstring is the corresponding key name, and the second parameter is a custom description. You can use Nil

 

4. localized application names

Edit info. plist and add the application has localized display name. Set the value to yes.

If the program automatically generatesInfoplist. Strings file. If no file exists, create one and perform steps 1 and 2.

Cfbundledisplayname values are defined in infoplist. Strings (English) and infoplist. Strings (Chinese) respectively.

"Cfbundledisplayname" = "app name ";
 
"Cfbundledisplayname" = "app name ";

Set the default value to Chinese: Edit info. plist, add the localization Native Development Region item, and set it to China.

 

5. The image is similar to the XIB file localization, you can also add the Same Name image file and XIB file in the corresponding en. lproj and zh-Hans.lproj directory

Add files to the project list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.