android-language Internationalization

Source: Internet
Author: User

android-Language Internationalization Reference

http://www.loc.gov/standards/iso639-2/php/code_list.php National language Tables

Overview

Internationalization (internationalization), aka i18n (because I there are only 18 letters at the beginning and end of the word n ), there is also localization (localization), aka l10n (the same name) as the international counterpart.

The internationalization of the Android language is to display different languages depending on the region (set by the system).

Android Internationalization

Here we 中文 English are internationalized with and between.

Set up the values folder for different countries

Because what we're doing here is internationalization between Chinese and English, so we've just created values-en this directory, and that's values下的额strings.xml our default language (loading this resource when the language of the system is not defined in the program's resources).

Start the layout
<?xmlVersion= "1.0" encoding= "Utf-8"?><linearlayoutxmlns:android="Http://schemas.android.com/apk/res/android"xmlns:tools="Http://schemas.android.com/tools"android:id="@+id/activity_main"android:layout_width="Match_parent"android:layout_height="Match_parent"android:orientation="Vertical"android:padding="10DP"tools:context="Little_david.internationalizationdemo.MainActivity">    <edittextandroid:layout_width="Match_parent"android:layout_height="Wrap_content"android:hint="User name"/>    <edittextandroid:layout_width="Match_parent"android:layout_height="Wrap_content"android:hint="Password"/>    <buttonandroid:layout_width="Match_parent"android:layout_height="Wrap_content"android:hint="Login"android:textallcaps="false"/></LinearLayout>

The cursor selects the hint property and then presses the ALT+Entry shortcut key, and then extracts all the strings in turn.

Revise Chinese as English

Edit vlaues-en/strings.xml File

<!--This is the file before editing--<?xmlVersion= "1.0" encoding= "Utf-8"?><resources>    <!--This is the name of our application and will not be automatically generated we need to add it manually--    <stringname="App_name">International Demo</string>    <stringname="Login_username">User name</string>    <stringname="Login_password">Password</string>    <stringname="LOGIN_LOGIN_BTN">Login</string></resources><!--This is the modified file--<resources>    <!--This is the name of our application and will not be automatically generated we need to add it manually--    <stringname="App_name">Internationalization Demo</string>    <stringname="Login_username">Username</string>    <stringname="Login_password">Password</string>    <stringname="LOGIN_LOGIN_BTN">Login</string></resources>
Test effect

In Settings, modify the current language version to Chinese

Modify the current system language to English

Summarize

Manual internationalization too tired ah, we need to use Androidstudio plug-in to help us to operate internationally. The name of the plugin is AndroidLocalizationer . How to use please Baidu.

android-language Internationalization

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.