Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba851845 authored by Andrew Solovay's avatar Andrew Solovay Committed by Android (Google) Code Review
Browse files

Merge "docs: Updates to N Preview multilingual support page" into mnc-mr-docs

parents 44cc0a76 440741da
Loading
Loading
Loading
Loading
+38 −37
Original line number Diff line number Diff line
@@ -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>
@@ -81,11 +81,11 @@ Use default (en)

<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>
@@ -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