From 440741da6f39c72f9afda671cf300cf2ccfda7e2 Mon Sep 17 00:00:00 2001
From: Andrew Solovay 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. 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. Prior to the Android N Developer Preview, Android could not always successfully
+ 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. In this example, the system displays English strings without
+ 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. The Android N Developer Preview brings more robust resource resolution, and
+ 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. With the N Developer Preview, the case described in Table 1 is resolved
+ With this Preview, the case described in Table 1 is resolved
differently:
Table 2. An improved resolution strategy for when there is no
exact locale match.Challenges in Resolving Language Resources
-fr_CH
default (en)
-de_DE
-es_ES
-fr_FR
-it_IT
+de_DE
+es_ES
+fr_FR
+it_IT
-Try fr_CH => Fail
@@ -79,13 +79,13 @@ Use default (en)
-
-Try fr => Fail
+Try fr_CH => Fail
+Try fr => Fail
Use default (en)
Improvements to Resource-Resolution Strategy
-Resource resolution examples
-
The Android N Developer Preview adds a new API {@code LocaleList.GetDefault()} +
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