120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtpage.title=Localization
2f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainparent.title=Application Resources
320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtparent.link=index.html
420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt@jd:body
520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<div id="qv-wrapper">
720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <div id="qv">
820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2>Localization quickview</h2>
1020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
1120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
1220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Android lets you create different resource sets for different locales.</li>
1320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>When your application runs, Android will load the resource set
1420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthat match the device's locale.</li>
1520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>If locale-specific resources are not available, Android falls back to
1620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdefaults.</li>
1720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>The emulator has features for testing localized apps. </li>
1820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
1920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
2020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2>In this document</h2>
2120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ol>
2220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#resource-switching">Overview: Resource-Switching in Android</a>
2320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
2420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</li>
2520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ol><li><a href="#defaults-r-important">Why Default Resources Are Important</a></li></ol>
2620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<li><a href="#using-framework">Using Resources for Localization</a>
2720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <ol>
28f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main    <li><a href="#creating-defaults">How to Create Default Resources</a></li>
29f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main    <li><a href="#creating-alternatives">How to Create Alternative Resources</a></li>
3020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <li><a href="#resource-precedence">Which Resources Take Precedence?</a></li>
3120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <li><a href="#referring-to-resources">Referring to Resources in Java</a></li>
32f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main  </ol>
3320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</li>
3420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<li><a href="#strategies">Localization Strategies</a></li>
3520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<li><a href="#testing">Testing Localized Applications</a></li>
3620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <ol>
3720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#device">Testing on a Device</a></li>
3820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#emulator">Testing on an Emulator</a></li>
3920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#test-for-default">Testing for Default Resources</a></li>
4020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </ol>
4120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<li><a href="#checklist">Localization Checklists</a></li>
4220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <ol>
4320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#planning-checklist">Planning and Design Checklist</a></li>
4420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#content-checklist">Content Checklist</a></li>
4520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><a href="#testing-checklist">Testing and Publishing Checklist</a></li>
4620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </ol>
4720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ol>
4820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
4920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2>See also</h2>
5020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <ol>
51f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main    <li><a href="{@docRoot}guide/topics/resources/providing-resources.html">Providing Resources</a></li>
5250e990c64fa23ce94efa76b9e72df7f8ec3cee6aScott Main    <li><a href="{@docRoot}guide/topics/ui/declaring-layout.html">Layouts</a></li>
5320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <li><a href="{@docRoot}reference/android/app/Activity.html#ActivityLifecycle">Activity Lifecycle</a></li>
5420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ol>
5520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</div>
5620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</div>
5720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
5820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Android will run on many  devices in many  regions. To reach the most users,
5920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtyour application should handle text, audio files, numbers, currency, and
6020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtgraphics in ways appropriate to the locales where your application will be used.
6120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</p>
6220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
6320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>This document describes best practices for localizing Android
6420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtapplications. The principles apply whether you are developing your application  
6520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtusing ADT with Eclipse, Ant-based tools, or any other IDE. </p>
6620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
6720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>You should already have a working knowledge of Java and be  familiar with
6820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtAndroid resource loading, the declaration of user interface elements in XML,
6920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdevelopment considerations such as Activity lifecycle, and general principles of
7020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtinternationalization and localization. </p>
7120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
7220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>It is good practice to use the Android resource framework to separate the
7320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlocalized aspects of your application as much as possible from the core Java
7420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtfunctionality:</p>
7520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
7620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
7720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>You can put most or all of the <em>contents</em> of your application's
7820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtuser interface into resource files, as described in this document and in <a
79f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainhref="{@docRoot}guide/topics/resources/providing-resources.html">Providing Resources</a>.</li>
8020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>The <em>behavior</em> of the user interface, on the other hand, is driven
8120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtby your Java code. 
8220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    For example, if users input data that needs to be formatted or sorted
8320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdifferently depending on locale, then you would use Java to handle the data
8420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtprogrammatically. This document does not cover how to  localize your Java code.
8520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</li>
8620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
8720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
8812a5475205243bc2d069a87d2c7d4982b5f4d11dScott Main<p>For a short guide to localizing strings in your app, see the training lesson, <a
8912a5475205243bc2d069a87d2c7d4982b5f4d11dScott Mainhref="{@docRoot}training/basics/supporting-devices/languages.html">Supporting Different Languages</a>. </p>
9020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
9120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
9220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2 id="resource-switching">Overview: Resource-Switching in Android</h2>
9320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
9420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Resources are text strings, layouts, sounds, graphics, and any other static
9520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdata that your  Android application  needs. An application can include multiple
9620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtsets of resources, each customized for a different device configuration. When a
9720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtuser runs the application,  Android    automatically selects and loads the 
9820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtresources that best match the device.</p>
9920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
10020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>(This document focuses on localization and locale. For a complete description
10120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtof resource-switching and all the types of configurations that you can
10220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtspecify &#8212; screen orientation, touchscreen type, and so on &#8212; see <a
103f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainhref="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">Providing
104f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainAlternative Resources</a>.)</p>
10520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
10620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<table border="0" cellspacing="0" cellpadding="0">
10720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr border="0">
10820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td width="180" style="border: 0pt none ;"><p class="special-note">
10920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <strong>When you write your application:</strong>
11020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <br><br>
111f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main    You create a set of default resources, plus alternatives to be used in
11220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    different locales.</p></td>
11320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td style="border: 0pt none; padding:0">
11420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <p style="border:0; padding:0"><img src="../../../images/resources/right-arrow.png" alt="right-arrow" 
11520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    width="51" height="17"></p></td>
11620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td width="180" style="border: 0pt none ;"><p class="special-note">
11720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <strong>When a user runs your application:</strong>
11820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <br><br>The Android system selects which resources to load, based on the
11920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    device's locale.</p></td>
12020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
12120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</table>
12220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
123f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main<p>When you write your application, you create default and alternative resources
12420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtfor your application to use. To create  resources, you place files within
12520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtspecially named subdirectories of the project's <code>res/</code> directory.
12620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</p>
12720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
12820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
12920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
13020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="defaults-r-important">Why Default Resources Are Important</h3>
13120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
13220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Whenever the application runs in a locale for which you have not provided
13320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlocale-specific text,  Android will load the default strings from
13420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/values/strings.xml</code>. If this default  file is absent, or if it 
13520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtis missing a string that your application needs, then your application will not run 
13620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtand will show an error. 
13720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtThe example below illustrates what can happen when the default text file is incomplete. </p>
13820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
13920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p><em>Example:</em>
14020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>An application's Java code refers to just two strings, <code>text_a</code> and 
14120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>text_b</code>. This application includes a localized resource file 
14220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	(<code>res/values-en/strings.xml</code>) that defines <code>text_a</code> and 
14320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>text_b</code> in English. This application also includes a default 
14420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	resource file (<code>res/values/strings.xml</code>) that includes a
14520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdefinition for <code>text_a</code>, but not for <code>text_b</code>:
14620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
14720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>This application might compile without a problem. An IDE such as Eclipse 
14820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  	will not highlight any errors if a resource is missing.</li>
14920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>When this application is launched on a device with locale set to English, 
15020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  	the application  might run without a problem, because 
15120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  	<code>res/values-en/strings.xml</code> contains both of the needed text 
15220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  	strings.</li>
15320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>However, <strong>the user  will see an error message and a Force Close 
15420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  	button</strong> when this application is launched on a device set to a 
15520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  	language other than English. The application will not load.</li>
15620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
15720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
15820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
15920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>To prevent this situation, make sure that a <code>res/values/strings.xml</code> 
16020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	file exists and that it defines every needed string. The situation applies to 
16120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	all types of resources, not just strings: You 
16220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	need to create a  set of default resource files containing all 
16320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	the resources that your application calls upon &#8212; layouts, drawables, 
16420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	animations, etc. For information about testing, see <a href="#test-for-default">
16520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	Testing for Default Resources</a>.</p>
16620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
16720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2 id="using-framework">Using Resources for Localization</h2>
16820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
16920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="creating-defaults">How to Create Default Resources</h3>
17020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
17120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Put the application's default text in
17220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedta file with the following location and name:</p>
17320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p><code>&nbsp;&nbsp;&nbsp;&nbsp;res/values/strings.xml</code> (required directory)</p>
17420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
17520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>The text strings in <code>res/values/strings.xml</code> should  use the
17620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdefault language, which is the language that you expect most of your application's users to
17720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtspeak.  </p>
17820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
17920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>The default resource set must also include any default drawables and layouts, 
18020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	and can include other types of resources such as animations. 
18120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<br>
18220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>&nbsp;&nbsp;&nbsp;&nbsp;res/drawable/</code>(required directory holding at least
1834d7bc65538c7cd9fbb1fbbcf22d1da47fcee1219Dirk Dougherty  one graphic file, for the application's icon on Google Play)<br>
18420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>&nbsp;&nbsp;&nbsp;&nbsp;res/layout/</code> (required directory holding an XML
18520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  file that defines the default layout)<br>
18620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>&nbsp;&nbsp;&nbsp;&nbsp;res/anim/</code> (required if you have any 
18720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>res/anim-<em>&lt;qualifiers&gt;</em></code> folders)<br>
18820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>&nbsp;&nbsp;&nbsp;&nbsp;res/xml/</code> (required if you have any 
18920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>res/xml-<em>&lt;qualifiers&gt;</em></code> folders)<br>
19020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>&nbsp;&nbsp;&nbsp;&nbsp;res/raw/</code> (required if you have any 
19120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>res/raw-<em>&lt;qualifiers&gt;</em></code> folders)
19220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</p>
19320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
19420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p class="note"><strong>Tip:</strong> In your code, examine each reference to 
19520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	an Android resource. Make sure that a default resource is defined for each
19620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	one. Also make sure that the default string file is complete: A <em>
19720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	localized</em> string file can contain a subset of the strings, but the 
19820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<em>default</em> string file must contain them all. 
19920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</p>
20020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
201f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main<h3 id="creating-alternatives">How to Create Alternative Resources</h3>
20220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
203f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main<p>A large part of localizing an application is providing alternative text for
204f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Maindifferent languages. In some cases you will also provide alternative graphics,
20520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtsounds, layouts, and other locale-specific resources. </p>
20620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
20720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>An application can specify many <code>res/<em>&lt;qualifiers&gt;</em>/</code>
208f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Maindirectories, each with different qualifiers. To create an alternative resource for
20920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedta different locale, you use a qualifier that specifies a language or a 
21020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlanguage-region combination. (The name of a resource directory must conform 
21120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtto the naming scheme described in 
212f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main<a href="{@docRoot}guide/topics/resources/providing-resources.html#AlternativeResources">Providing
213f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainAlternative Resources</a>,
21420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtor else it will not compile.)</p>
21520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
21620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p><em>Example:</em></p>
21720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
21820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Suppose that your application's default language is English. Suppose also
21920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthat you want to localize all the text in your application to French, and most
22020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtof the text in your application (everything except the application's title) to
221f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainJapanese. In this case, you could create three alternative <code>strings.xml</code>
22220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtfiles, each stored in a locale-specific resource directory:</p>
22320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
22420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ol>
22520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><code>res/values/strings.xml</code><br>
22620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    Contains  English text for all  the strings that the application uses,
22720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtincluding text for a string named <code>title</code>.</li>
22820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><code>res/values-fr/strings.xml</code><br>
22920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    Contain French text for all  the strings, including <code>title</code>.</li>
23020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><code>res/values-ja/strings.xml</code><br>
23120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    Contain Japanese text for all  the strings <em>except</em>
23220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>title</code>.<br>
23320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code></code></li>
23420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ol>
23520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
23620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>If your Java code refers to <code>R.string.title</code>,  here is what will
23720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedthappen at runtime:</p>
23820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
23920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
24020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>If the device is set to any language other than French, Android will load
24120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>title</code> from the <code>res/values/strings.xml</code> file.</li>
24220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>If the device is set to French, Android will load <code>title</code> from
24320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthe <code>res/values-fr/strings.xml</code> file.</li>
24420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
24520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
24620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Notice that if the device is set to Japanese, Android will look for
24720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>title</code> in the <code>res/values-ja/strings.xml</code> file. But
24820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtbecause no such string is included in that file, Android will fall back to the
24920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdefault, and will load  <code>title</code> in English from the
25020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/values/strings.xml</code> file.  </p>
25120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
25220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="resource-precedence">Which Resources Take Precedence?</h3>
25320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
25420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p> If multiple resource files match a device's configuration, Android follows a
25520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtset of rules in deciding which file to use. Among the qualifiers that can be
25620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtspecified in a resource directory name, <strong>locale almost always takes
25720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtprecedence</strong>. </p>
25820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p><em>Example:</em></p>
25920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
26020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Assume that an application  includes a default set of graphics and two other
26120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtsets of graphics, each optimized for a different device setup:</p>
26220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
26320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
26420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><code>res/drawable/</code><br>
26520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    Contains
26620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  default graphics.</li>
26720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><code>res/drawable-small-land-stylus/</code><br>
26820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  Contains  graphics optimized for use with a device that expects input from a 
26920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  stylus and has a QVGA low-density screen in landscape orientation.</li>
27020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li><code>res/drawable-ja/</code> <br>
27120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  Contains  graphics optimized for use with Japanese.</li>
27220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
27320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
27420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>If the application runs on a device that is configured to use Japanese,
27520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtAndroid will load graphics from  <code>res/drawable-ja/</code>, even if the
27620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdevice happens to be one that expects input from a stylus and has a QVGA 
27720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlow-density screen in landscape orientation.</p>
27820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
27920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p class="note"><strong>Exception:</strong> The only qualifiers that take
28020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtprecedence over locale in the selection process are MCC and MNC (mobile country
28120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtcode and mobile network code). </p>
28220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
28320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p><em>Example:</em></p>
28420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
28520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Assume that you have the following situation:</p>
28620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
28720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
28820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>The application code calls for <code>R.string.text_a</code></li>
28920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Two relevant resource files are available:
29020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <ul>
29120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt      <li><code>res/values-mcc404/strings.xml</code>, which includes
29220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>text_a</code> in the application's default language, in this case
29320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtEnglish.</li>
29420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt      <li><code>res/values-hi/strings.xml</code>, which includes
29520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>text_a</code> in Hindi.</li>
29620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    </ul>
29720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </li>
29820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>The application is running on a device that has the following
29920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtconfiguration:
30020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <ul>
30120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt      <li>The SIM card is connected to a mobile network in India (MCC 404).</li>
30220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt      <li>The language is set to Hindi (<code>hi</code>).</li>
30320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    </ul>
30420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </li>
30520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
30620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
30720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Android will load <code>text_a</code> from
30820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/values-mcc404/strings.xml</code> (in English), even if the device is
30920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtconfigured for Hindi. That is because in the resource-selection process, Android
31020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtwill prefer an MCC match over a language match. </p>
31120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
31220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>The selection process is not always as straightforward as these examples
313f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainsuggest. Please read  <a
3145dd0fd5c89099f194b9ec2323bb6413fa48e7db8Scott Mainhref="{@docRoot}guide/topics/resources/providing-resources.html#BestMatch">How Android Finds
315f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainthe Best-matching Resource</a> for a more nuanced description of the
31620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtprocess. All the qualifiers are described and listed in order of
317f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainprecedence in <a
3185dd0fd5c89099f194b9ec2323bb6413fa48e7db8Scott Mainhref="{@docRoot}guide/topics/resources/providing-resources.html#table2">Table 2 of Providing
319f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainAlternative Resources</a>.</p>
32020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
32120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="referring-to-resources">Referring to Resources in Java</h3>
32220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
32320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>In your application's Java code, you refer to  resources using the syntax
32420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>R.<em>resource_type</em>.<em>resource_name</em></code> or
32520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>android.R.<em>resource_type</em>.<em>resource_name</em></code><em>.</em>
326f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainFor more about this, see <a
3275dd0fd5c89099f194b9ec2323bb6413fa48e7db8Scott Mainhref="{@docRoot}guide/topics/resources/accessing-resources.html">Accessing Resources</a>.</p>
32820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
32920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2 id="strategies">Localization Strategies</h2>
33020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
33120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h4 id="failing2">Design your application  to work in any locale</h4>
33220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
33320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>You cannot assume anything about the device on which a user will
33420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtrun your application. The device might have hardware that you were not
33520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtanticipating, or it might be set to a locale that you did not plan for or that 
33620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtyou cannot test. Design your application so that it will function normally or fail gracefully no 
33720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtmatter what device it runs on.</p>
33820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
33920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p class="note"><strong>Important:</strong> Make sure that your application
34020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtincludes a full set of default resources.</p> <p>Make sure to include
34120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/drawable/</code> and a <code>res/values/</code> folders (without any
34220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtadditional modifiers in the folder names) that contain all the images and text
34320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthat your application will need. </p>
34420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
34520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>If an application is missing even one default resource, it will not run on a 
34620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	device that is set to an unsupported locale. For example, the 
34720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>res/values/strings.xml</code> default file might lack one string that 
34820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	the application needs: When the application runs in an unsupported locale and 
34920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	attempts to load <code>res/values/strings.xml</code>, the user will see an 
35020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	error message and a Force Close button. An IDE such as Eclipse will not 
35120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	highlight this kind of error, and you will not see the problem when you 
35220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	test the application on a device or emulator that is set to a supported locale.</p>
35320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
35420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>For more information, see <a href="#test-for-default">Testing for Default Resources</a>.</p>
35520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
35620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h4>Design a flexible layout</h4>
35720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
35820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p> If you need to rearrange your layout to fit a certain language (for example
359f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainGerman with its long words), you can create an alternative layout for that
36020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlanguage (for example <code>res/layout-de/main.xml</code>). However, doing this
36120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtcan make your application harder to maintain.  It is better to create a single
36220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlayout that is more flexible.</p>
36320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
36420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Another typical situation is a language that requires something different in
36520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtits layout. For example, you might have a contact form that should include  two
36620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtname fields when the application runs in Japanese, but three name fields when
36720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthe application  runs in some other language. You could handle this in either of
36820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedttwo ways:</p>
36920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
37020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
37120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Create  one  layout with a field that you can programmatically enable or
37220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdisable, based on the language, or</li>
37320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Have the main layout include another layout that  includes the changeable
37420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtfield. The second layout can have different configurations for different
37520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlanguages.</li>
37620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
37720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
37820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h4>Avoid creating more resource files and text strings than you need</h4>
37920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
38020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>You probably do not need to create a locale-specific
38120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtalternative for every resource in your application. For example, the layout
38220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdefined in the <code>res/layout/main.xml</code> file might work in any locale,
383f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Mainin which case there would be no need to create any alternative layout files.
38420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</p>
38520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
386f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott Main<p>Also, you might not need to create alternative text for every
38720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtstring. For example, assume the following:</p>
38820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
38920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
39020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Your application's default language is American
39120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtEnglish. Every string that the application uses is defined, using American
39220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtEnglish spellings, in <code>res/values/strings.xml</code>. </li>
39320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
39420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>For  a few important phrases, you want to provide
395f940a1f316ddbed760f6f3ab9a3e4f2112909381Scott MainBritish English spelling. You want these alternative strings to be used when your
39620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtapplication runs on a device in the United Kingdom. </li>
39720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
39820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
39920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>To do this, you could create a small file called
40020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/values-en-rGB/strings.xml</code> that includes only the strings that
40120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtshould be different when the application  runs in the U.K. For all the rest of
40220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthe strings, the application will fall back to the defaults and use what is
40320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtdefined in <code>res/values/strings.xml</code>.</p>
40420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
40520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h4>Use the Android Context object for manual locale lookup</h4>
40620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
40720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>You can look up the locale using the {@link android.content.Context} object
40820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthat Android makes available:</p>
40920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
41020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<pre>String locale = context.getResources().getConfiguration().locale.getDisplayName();</pre>
41120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
41220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2 id="testing">Testing Localized Applications</h2>
41320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
41420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="device">Testing on a Device</h3>
41520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Keep in mind that the device you are testing may be significantly different from 
41620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	the devices available to consumers in other geographies. The locales available 
41720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	on your device may differ from those available on other devices. Also, the 
41820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	resolution and density of the device screen may differ, which could affect 
41920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	the display of strings and drawables in your UI.</p>
42020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
42120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>To change the locale on a device, use  the Settings application  (Home &gt;
42220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtMenu &gt; Settings &gt; Locale &amp; text &gt; Select locale). </p>
42320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
42420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="emulator">Testing on an Emulator</h3>
42520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
42620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>For details about using the emulator, see See <a
42750e990c64fa23ce94efa76b9e72df7f8ec3cee6aScott Mainhref="{@docRoot}tools/help/emulator.html">Android Emulator</a>.</p>
42820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h4>Creating and using a custom locale</h4>
42920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
4309519eab313fdb0f74a05e85cffe25b61aa76a5ddDirk Dougherty<p>A &quot;custom&quot; locale is a language/region combination that the Android
4319519eab313fdb0f74a05e85cffe25b61aa76a5ddDirk Doughertysystem image does not explicitly support. (For a list of supported locales in
4329519eab313fdb0f74a05e85cffe25b61aa76a5ddDirk DoughertyAndroid platforms see the Version Notes in the <a
4339519eab313fdb0f74a05e85cffe25b61aa76a5ddDirk Doughertyhref="{@docRoot}sdk/index.html">SDK</a> tab). You can test
4349519eab313fdb0f74a05e85cffe25b61aa76a5ddDirk Doughertyhow your application will run in a custom locale by creating a custom locale in
4359519eab313fdb0f74a05e85cffe25b61aa76a5ddDirk Doughertythe emulator. There are two ways to do this:</p>
43620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
43720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ul>
43820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Use the Custom Locale application, which is accessible from the
43920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtApplication tab. (After you create a custom locale, switch to it by 
44020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtpressing and holding the locale name.)</li>
44120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Change to a custom locale from the adb shell, as described below.</li>
44220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ul>
44320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
44420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>When you set the emulator to a locale that is not available in the Android
44520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtsystem image, the system itself will display in its default language. Your
44620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtapplication, however, should localize properly.</p>
44720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
44820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h4>Changing the emulator locale from the adb shell</h4>
44920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
45020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>To change the locale in the emulator by using the adb shell. </p>
45120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
45220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ol>
45320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Pick the locale you want to test and determine its language and region codes, for
45420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtexample <code>fr</code> for French and <code>CA</code> for Canada.<br>
45520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </li>
45620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>Launch an emulator.</li>
45720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>From a command-line shell on the host computer, run the following
45820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtcommand:<br>
45920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <code>adb shell</code><br>
46020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  or if you have a device attached, specify that you want the emulator by adding
46120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthe <code>-e</code> option:<br>
46220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <code>adb -e shell</code></li>
46320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <li>At  the  adb shell prompt (<code>#</code>), run this command: <br>
46420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <code>setprop persist.sys.language  [<em>language code</em>];setprop
46520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtpersist.sys.country [<em>country  code</em>];stop;sleep 5;start <br>
46620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    </code>Replace bracketed sections with the  appropriate codes from Step
46720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt1.</li>
46820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ol>
46920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
47020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>For instance, to test in Canadian French:</p>
47120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
47220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p><code>setprop persist.sys.language  fr;setprop persist.sys.country
47320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtCA;stop;sleep 5;start </code></p>
47420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
47520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>This will cause the emulator  to restart. (It will look like a full reboot,
47620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtbut it is not.) Once the Home screen appears again, re-launch your application (for
47720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtexample, click the Run icon in Eclipse), and the application will launch with
47820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtthe new locale. </p>
47920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
48020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="test-for-default">Testing for Default Resources</h3>
48120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>Here's how to test whether an application includes every string resource that it needs:  </p>
48220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<ol><li>Set the emulator or device to a language that your application does not 
48320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	support. For example, if the application has French strings in 
48420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>res/values-fr/</code> but does not have any Spanish strings in 
48520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>res/values-es/</code>, then set the emulator's locale to Spanish. 
48620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	(You can use the Custom Locale application to set the emulator to an 
48720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	unsupported locale.)</li>
48820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<li>Run the application.</li>  
48920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<li>If the application shows an error message and a Force Close button, it might 
49020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	be looking for a string that is not available. Make sure that your 
49120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>res/values/strings.xml</code> file includes a definition for 
49220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	every string that the application uses.</li>
49320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</ol> 
49420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</p> 
49520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
49620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>If the test is successful, repeat it for other types of 
49720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	configurations. For example, if the application has a layout file called 
49820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>res/layout-land/main.xml</code> but does not contain a file called 
49920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	<code>res/layout-port/main.xml</code>, then set the emulator or device to 
50020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt	portrait orientation and see if the application will run. 
50120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
50220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
50320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h2 id="checklist">Localization Checklists</h2>
50420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
50520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<p>These  checklists summarize the process of localizing an Android application.
50620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina StenstedtNot everything on these lists will apply to every application.</p>
50720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
50820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="planning-checklist">Planning and Design Checklist</h3>
50920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt
51020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<table  width="100%" border="0" cellpadding="5" cellspacing="0">
51120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
51220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
51320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
51420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Choose a localization strategy. Which countries and which languages will
51520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtyour application support? What is your application's default country and
51620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlanguage? How will your application behave when it does not have specific
51720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtresources available for a given locale?</td>
51820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
51920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
52020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
52120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
52220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td><p>Identify everything in your application   that will need to be
52320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlocalized: </p>
52420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt      <ul>
52520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt        <li>Consider  specific details of your application &#8212; text,  images, 
52620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtsounds, music, numbers, money, dates and times. You might not need to localize
52720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedteverything. For example, you don't need to localize text that the user never
52820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtsees, or images that are culturally neutral, or icons that convey the same
52920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtmeaning in every locale. </li>
53020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt        <li>Consider broad themes. For example, if you hope to sell your
53120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtapplication in two very culturally different markets, you might want to design
53220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtyour UI and present your application in an entirely different way for each
53320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlocale.</li>
53420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    </ul></td>
53520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
53620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
53720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
53820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
53920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td><p>Design your Java code to externalize resources wherever possible:</p>
54020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt      <ul>
54120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt        <li>Use <code>R.string</code> and <code>strings.xml</code> files instead
54220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtof hard-coded strings or string constants. </li>
54320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt        <li>Use <code>R.drawable</code> and <code>R.layout</code> instead of 
54420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedthard-coded drawables or layouts. </li>
54520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    </ul></td>
54620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
54720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</table>
54820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="content-checklist">Content Checklist</h3>
54920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<table border="0" cellspacing="0" cellpadding="5"  width="100%">
55020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
55120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
55220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
55320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Create a full set of default resources in <code>res/values/</code> and
55420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtother <code>res/</code> folders, as described in <a
55520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedthref="#creating-defaults">Creating Default Resources</a>.</td>
55620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
55720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
55820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
55920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
56020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Obtain reliable translations of  the static text, including menu text,
56120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtbutton names, error messages, and help text. Place the translated strings in
56220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/values-<em>&lt;qualifiers&gt;</em>/strings.xml</code> files. </td>
56320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
56420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
56520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
56620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
56720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Make sure that your application correctly formats dynamic text (for
56820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtexample numbers and dates) for each supported locale. Make sure that your
56920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtapplication handles word breaks, punctuation, and alphabetical sorting correctly
57020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtfor each supported language.</td>
57120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
57220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
57320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
57420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
57520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>If necessary, create locale-specific versions of your graphics and
57620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlayout, and place them in <code>res/drawable-<em>&lt;qualifiers&gt;</em>/</code> and
57720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<code>res/layout-<em>&lt;qualifiers&gt;</em>/</code> folders.</td>
57820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
57920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
58020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
58120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
58220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Create any other localized content that your application requires; for
58320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtexample, create recordings of sound files for each language, as needed.</td>
58420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
58520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</table>
58620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt<h3 id="testing-checklist">Testing and Publishing Checklist</h3>
58720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <table border="0" cellspacing="0" cellpadding="5" width="100%">
58820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
58920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
59020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
59120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Test your application for each supported locale. If possible, have a
59220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtperson who is native to each locale test your application and give you
59320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtfeedback.</td>
59420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
59520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
59620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
59720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
59820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Test the default resources by loading a locale that is not available on 
59920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    	the device or emulator. For instructions, see <a href="#test-for-default">
60020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    		Testing for Default Resources</a>.  </td>
60120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
60220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <tr>
60320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
60420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
60520972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Test the localized strings in both landscape and portrait display modes.</td>
60620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
60720972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <tr>
60820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
60920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
61020972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td>Sign your application and create your final build or builds.</td>
61120972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
61220972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  <tr>
61320972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt    <td valign="top" align="center"><img src="../../../images/resources/arrow.png" alt="arrow" width="26"
61420972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtborder="0"></td>
6154d7bc65538c7cd9fbb1fbbcf22d1da47fcee1219Dirk Dougherty    <td>Upload your .apk file or files to Google Play, selecting the appropriate
61620972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedtlanguages as
61750e990c64fa23ce94efa76b9e72df7f8ec3cee6aScott Main    you upload.</td>
61820972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt  </tr>
61920972da079adb6e53fe5f8758aa473d9d46a1b54Katarina Stenstedt</table>