docs: Updates to N Preview multilingual support page
Continues work from changelist http://ag/874044 Misc. fixes to doc, including changing the release name (from "N Developer Preview" to just "the Preview") after first use. See first comment for doc stage location. bug: 27048604 Change-Id: Ib00249e63d4649b834937f5dfe51e115c9472525
This commit is contained in:
@@ -16,24 +16,24 @@ page.title=Language and Locale
|
||||
</div>
|
||||
|
||||
<p>Android N Developer Preview provides enhanced support for multilingual users,
|
||||
allowing them to select multiple locales in settings. The N Developer Preview
|
||||
allowing them to select multiple locales in settings. The Preview
|
||||
provides this capability by greatly expanding the number of locales supported
|
||||
and changing the way the system resolves resources. The new method of resolving
|
||||
resources is more robust and designed to be compatible with existing APKs, but
|
||||
you should take extra care to spot any unexpected behavior. For example, you
|
||||
should test to make sure that your app defaults to the expected language. Also,
|
||||
if it supports multiple languages, you should ensure that this support works as
|
||||
intended. Last, you should try to ensure that your app gracefully handles
|
||||
if your app supports multiple languages, you should ensure that this support works as
|
||||
intended. Finally, you should try to ensure that your app gracefully handles
|
||||
languages that you didn't explicitly design it to support.</p>
|
||||
|
||||
<p>This document starts by explaining the resource resolution strategy prior to
|
||||
the N Developer Preview. Next, it describes the N Developer Preview's improved
|
||||
the Preview. Next, it describes the Preview's improved
|
||||
resource-resolution strategy. Last, it explains how to take advantage of
|
||||
the expanded number of locales to support more multilingual users.</p>
|
||||
|
||||
<h2 id="preN">Challenges in Resolving Language Resources</h2>
|
||||
|
||||
<p>Prior to the Android N Developer Preview, Android could not always successfully
|
||||
<p>Prior to this Preview, Android could not always successfully
|
||||
match app and system locales. For example, suppose that your app's default language
|
||||
is US English, but that it also has Spanish strings localized in {@code es_ES}
|
||||
resource files.</p>
|
||||
@@ -64,14 +64,14 @@ language that the app didn't support at all, like French.</li>
|
||||
<td>fr_CH</td>
|
||||
<td>
|
||||
default (en)<br>
|
||||
de_DE <br>
|
||||
es_ES <br>
|
||||
fr_FR <br>
|
||||
it_IT <br>
|
||||
de_DE<br>
|
||||
es_ES<br>
|
||||
fr_FR<br>
|
||||
it_IT<br>
|
||||
</td>
|
||||
<td>
|
||||
Try fr_CH => Fail <br>
|
||||
Try fr => Fail <br>
|
||||
Try fr_CH => Fail<br>
|
||||
Try fr => Fail<br>
|
||||
Use default (en)
|
||||
</td>
|
||||
</tr>
|
||||
@@ -79,13 +79,13 @@ Use default (en)
|
||||
</table>
|
||||
|
||||
|
||||
<p>In this example, the system displays English strings without
|
||||
<p>In this example, the system displays English strings without
|
||||
knowing whether the user can understand English. This behavior is pretty common
|
||||
today. The Android N Developer Preview should substantially reduce the frequency
|
||||
today. The Preview should substantially reduce the frequency
|
||||
of outcomes like this one.</p>
|
||||
|
||||
<h2 id="postN">Improvements to Resource-Resolution Strategy</h2>
|
||||
<p>The Android N Developer Preview brings more robust resource resolution, and
|
||||
<p>The Preview brings more robust resource resolution, and
|
||||
finds better fallbacks automatically. However, to speed up resolution and improve
|
||||
maintainability, you should store resources in the most common parent dialect.
|
||||
For example, if you were storing Spanish resources in the {@code es-US} directory
|
||||
@@ -98,8 +98,9 @@ reliability of resource resolution.</p>
|
||||
|
||||
<h3>Resource resolution examples</h3>
|
||||
|
||||
<p>With the N Developer Preview, the case described in <a href="#t1">Table 1</a> is resolved
|
||||
<p>With this Preview, the case described in <strong>Table 1</strong> is resolved
|
||||
differently:</p>
|
||||
|
||||
<p class="table-caption" id="t-improved-res">
|
||||
<strong>Table 2.</strong> An improved resolution strategy for when there is no
|
||||
exact locale match.</p>
|
||||
@@ -111,20 +112,20 @@ exact locale match.</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><ol>
|
||||
<li> fr_CH </li>
|
||||
<li> fr_CH</li>
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
default (en) <br>
|
||||
de_DE <br>
|
||||
es_ES <br>
|
||||
fr_FR <br>
|
||||
it_IT <br>
|
||||
default (en)<br>
|
||||
de_DE<br>
|
||||
es_ES<br>
|
||||
fr_FR<br>
|
||||
it_IT<br>
|
||||
</td>
|
||||
<td>
|
||||
Try fr_CH => Fail <br>
|
||||
Try fr => Fail <br>
|
||||
Try children of fr => fr_FR <br>
|
||||
Try fr_CH => Fail<br>
|
||||
Try fr => Fail<br>
|
||||
Try children of fr => fr_FR<br>
|
||||
Use fr_FR
|
||||
</td>
|
||||
</tr>
|
||||
@@ -153,23 +154,23 @@ user's second-preferred locale setting.</p>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><ol>
|
||||
<li> fr_CH </li>
|
||||
<li> it_CH </li>
|
||||
<li> fr_CH</li>
|
||||
<li> it_CH</li>
|
||||
</ol>
|
||||
</td>
|
||||
<td>
|
||||
default (en) <br>
|
||||
de_DE <br>
|
||||
es_ES <br>
|
||||
it_IT <br>
|
||||
default (en)<br>
|
||||
de_DE<br>
|
||||
es_ES<br>
|
||||
it_IT<br>
|
||||
</td>
|
||||
<td>
|
||||
Try fr_CH => Fail <br>
|
||||
Try fr => Fail <br>
|
||||
Try children of fr => Fail <br>
|
||||
Try it_CH => Fail <br>
|
||||
Try it => Fail <br>
|
||||
Try children of it => it_IT <br>
|
||||
Try fr_CH => Fail<br>
|
||||
Try fr => Fail<br>
|
||||
Try children of fr => Fail<br>
|
||||
Try it_CH => Fail<br>
|
||||
Try it => Fail<br>
|
||||
Try children of it => it_IT<br>
|
||||
Use it_IT
|
||||
</td>
|
||||
|
||||
@@ -183,7 +184,7 @@ support French.</p>
|
||||
<h2 id="design">Designing your App to Support Additional Locales</h2>
|
||||
<h3>LocaleList API</h3>
|
||||
|
||||
<p>The Android N Developer Preview adds a new API {@code LocaleList.GetDefault()}
|
||||
<p>The Preview adds a new API {@code LocaleList.GetDefault()}
|
||||
that lets apps directly query the list of languages a user has specified. This API
|
||||
allows you to create more sophisticated
|
||||
app behavior and better-optimized display of content. For example, Search
|
||||
|
||||
Reference in New Issue
Block a user