Android Application resource-localization (III)

Source: Internet
Author: User

Test localized applications

Test on the device

Remember that the device you are using may be significantly different from the device used by consumers in other regions. The language environment on the test device is different from that on other devices, and the resolution and density of the device screen may also be different, which will affect the display of strings and descriptive Resources in the UI.

Use the setting application (home-> menu-> Settings-> locale & text-> select locale) of the Android system to change the language environment of the device, to test applications in different language environments.

Test on Simulator

For details about how to use the simulated test, see "android
Simulator documentation.

Create and use a custom language environment

The custom language environment is a combination of languages/regions not explicitly supported by Android images. (In the SDK option version comment, you can see the list of supported Language Environments on the Android platform .) By creating a custom language environment in the simulator, you can test how an application runs in a custom language environment. There are two ways to create a custom language environment:

1. You can access the application in a custom language environment from the Application tab. (After creating a custom language environment, you can press and hold the name of the custom language environment to switch .)

2. Use the method described below to change from the ADB shell to the custom language environment.

When the simulator is set to a language environment not supported by the Android system image, the system will display it in its default language. But the application should be correctly localized.

Change the language environment of the simulator from the ADB Shell

1. Select the language environment to be tested and determine its language and region code, for example, France is Fr, Canada is ca;

2. Start the simulator;

3. In the command line window of the computer, run the following command:

ADB Shell

Or, if a device has been bound, add-e
Option to specify the desired Simulator

ADB-e Shell

4. Run the following command at the ADB prompt:

Setprop persist. SYS. language [Language code]; Setprop persist. SYS. Country [Country
Code
]; Stop; sleep 5; Start

Replace the content in square brackets with the appropriate code in step 1.

This causes the simulator to restart. (It seems to be completely restarted, but not actually .) Once the main screen is re-displayed, your application will be reloaded and the application will be started in a new language environment.

Test default Resources

The following describes how to test whether an application contains every string resource method required by the application:

1.
Set the simulator or device to a language environment not supported by the application. For example, if the application contains a French string in the Res/Values-fr/directory, but there is no Spanish string in the Res/Values-ES/directory, set the language environment of the simulator to Spanish. (You can use a custom language environment application to set an unsupported language environment for the simulator .)

2. Run the application

3. If an error or force close button is displayed in the application, an invalid string may occur. Make sure that the Res/values/strings. xml file contains the definition of each string required by the application.

If the test is successful, repeat the tests of other configuration types. For example, if an application named Res/Layout-land/main. XML layout file, but it is not called res/Layout-Port/main. XML layout file, set the simulator to the vertical direction, and view the application running results.

Publish a localized application

Google Play is the main application Release System for Android devices. To publish a localized application, you must digitally sign the application, assign the version number, and perform other steps. For details, refer to the "prepare for release" document.

Http://developer.android.com/guide/publishing/preparing.html

If you want to divide an application into several .apk files, each of which targets a different language environment, follow the following principles:

1. Use the same certificate to sign each. APK file. For more information, see "digital signature policy ".

Http://developer.android.com/guide/publishing/app-signing.html#strategies

2. For each. APK file with different application names, currently, it is impossible to publish two applications with identical names to Google Play.

3. Complete default resources must be included in each. APK file.

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.