- Android - Intents/Filters
- Android - Fragments
- Android - Content Providers
- Android - Broadcast Receivers
- Android - Services
- Android - Activities
- Android - Resources
- Android - Hello World Example
- Android - Application Components
- Android - Architecture
- Android - Environment Setup
- Android - Overview
- Android - Home
Android - User Interface
- Android - Custom Components
- Android - Styles and Themes
- Android - Event Handling
- Android - UI Controls
- Android - UI Layouts
Android Advanced Concepts
- Publishing Android Application
- Android - Phone Calls
- Android - Sending SMS
- Android - Sending Email
- Location Based Services
- Android - Notifications
- Android - Drag and Drop
Android Useful Examples
- Android - XML Parsers
- Android - Widgets
- Android - Wi-Fi
- Android - WebView Layout
- Android - UI Testing
- Android - UI Patterns
- Android - UI Design
- Android - Twitter Integration
- Android - TextureView
- Android - Text to Speech
- Android - Testing
- Android - Support Library
- Android - SQLite Database
- Android - Spelling Checker
- Android - SIP Protocol
- Android - Shared Preferences
- Android - Session Management
- Android - Sensors
- Android - SDK Manager
- Android - Screen Cast
- Android - RSS Reader
- Android - RenderScript
- Android - Push Notification
- Android - ProgressBar
- Android - Progress Circle
- Android - PHP/MySQL
- Android - NFC Guide
- Android - Network Connection
- Android - Navigation
- Android - Multitouch
- Android - MediaPlayer
- Android - Login Screen
- Android - Localization
- Android - Loading Spinner
- Android - Linkedin Integration
- Android - JSON Parser
- Android - JetPlayer
- Android - Internal Storage
- Android - ImageSwitcher
- Android - Image Effects
- Android - Google Maps
- Android - Gestures
- Android - Facebook Integration
- Android - Emulator
- Android - Developer Tools
- Android - Data Backup
- Android - Custom Fonts
- Android - Clipboard
- Android - Camera
- Android - Bluetooth
- Android - Best Practices
- Android - Auto Complete
- Android - AudioManager
- Android - Audio Capture
- Android - Animations
- Android - Alert Dialoges
Android Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Android - Locapzation
An android apppcation can run on many devices in many different regions. In order to make your apppcation more interactive, your apppcation should handle text,numbers,files e.t.c in ways appropriate to the locales where your apppcation will be used.
The way of changing string into different languages is called as locapzation
In this chapter we will explain , how you can locapze your apppcation according to different regions e.t.c. We will locapze the strings used in the apppcation, and in the same way other things can be locapzed.
Locapzing Strings
In order to locapze the strings used in your apppcation , make a new folder under res with name of values-local where local would be the replaced with the region.
For example, in the case of italy, the values-it folder would be made under res. It is shown in the image below −
![Anroid Locapzation Tutorial](/android/images/string.jpg)
Once that folder is made, copy the strings.xmlfrom default folder to the folder you have created. And change its contents. For example, i have changed the value of hello_world string.
Italy, res/values-it/strings.xml
<;?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello_world">Ciao mondo!</string> </resources>
Spanish, res/values-it/strings.xml
<;?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello_world">Hola Mundo!</string> </resources>
French, res/values-it/strings.xml
<;?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello_world">Bonjour le monde !</string> </resources>
Apart from these languages, the region code of other languages have been given in the table below −
Sr.No | Language & code |
---|---|
1 | Afrikanns Code: af. Folder name: values-af |
2 | Arabic Code: ar. Folder name: values-ar |
3 | Bengap Code: bn. Folder name: values-bn |
4 | Czech Code: cs. Folder name: values-cs |
5 | Chinese Code: zh. Folder name: values-zh |
6 | German Code: de. Folder name: values-de |
7 | French Code: fr. Folder name: values-fr |
8 | Japanese Code: ja. Folder name: values-ja |
Example
To experiment with this example , you can run this on an actual device or in an emulator.
Steps | Description |
---|---|
1 | You will use Android studio to create an Android apppcation under a package com.example.sairamkrishna.myapppcation. |
2 | Modify the res/layout/activity_main to add respective XML components |
3 | Modify the res/values/string.xml to add necessary string components |
4 | Run the apppcation and choose a running android device and install the apppcation on it and verify the results |
Following is the modified content of the xml res/layout/activity_main.xml.
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <TextView android:text="Wifi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview" android:textSize="35dp" android:layout_apgnParentTop="true" android:layout_centerHorizontal="true" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Tutorials point" android:id="@+id/textView" android:layout_below="@+id/textview" android:layout_centerHorizontal="true" android:textColor="#ff7aff24" android:textSize="35dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hindi" android:id="@+id/textView2" android:layout_below="@+id/textView" android:layout_centerHorizontal="true" android:layout_marginTop="50dp" android:textColor="#ff59ff1a" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/marathi" android:id="@+id/textView3" android:textSize="30dp" android:textColor="#ff67ff1e" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/arabic" android:id="@+id/textView4" android:layout_below="@+id/textView3" android:layout_centerHorizontal="true" android:layout_marginTop="42dp" android:textColor="#ff40ff08" android:textSize="30dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/chinese" android:id="@+id/textView5" android:layout_below="@+id/textView4" android:layout_apgnLeft="@+id/textView3" android:layout_apgnStart="@+id/textView3" android:layout_marginTop="42dp" android:textSize="30dp" android:textColor="#ff56ff12" android:layout_apgnRight="@+id/textView3" android:layout_apgnEnd="@+id/textView3" /> </RelativeLayout>
Following is the content of the res/values/string.xml.
<resources> <string name="app_name">My Apppcation</string> <string name="hello_world">Hello world!</string> <string name="action_settings">Settings</string> <string name="hindi">ట్యుటోరియల్స్ పాయింట్</string> <string name="marathi">शिकवण्या बिंदू</string> <string name="arabic">نقطة الدروس7</string> <string name="chinese">教程点</string> </resources>
Let s try to run our apppcation we just modified. I assume you had created your AVD while doing environment setup. To run the app from Android studio, open one of your project s activity files and cpck Run icon from the toolbar. Android studio installs the app on your AVD and starts it and if everything is fine with your setup and apppcation, it will display following Emulator window −
![Anroid Locapzation Tutorial](/android/images/locapzation.jpg)