Bug 1405404: Add 'de' to list of pocket whitelisted locales. r=liuche
This is used in multi-locale builds, e.g. [1] where all German is "de" but in
[2], we have a separate l10n repo for en-GB.
[1]: https://hg.mozilla.org/releases/l10n/mozilla-beta/de
[2]: https://hg.mozilla.org/releases/l10n/mozilla-beta/en-GB
MozReview-Commit-ID: CXw9aFH9psz
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/ActivityStreamConfiguration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/ActivityStreamConfiguration.java
@@ -17,18 +17,26 @@ import java.util.Set;
/**
* Static functions for accessing user configuration information.
*
* TODO (bug 1405161): we should move all configuration accesses to this class to centralize them.
*/
public class ActivityStreamConfiguration {
private static final Set<Locale> pocketEnabledLocales;
+
+ /**
+ * Notes for testing: Firefox for Android can get its locale from two places: the system locale and an override for
+ * this locale specified in Fennec settings. As such, you should be sure to test all locale updates with both
+ * settings when possible. For example, Deutsch will be "de-DE" in the Android system but "de" when using the Fennec
+ * override.
+ */
@VisibleForTesting static final String[] pocketEnabledLocaleTags = new String[] {
// Sorted alphabetically to preserve blame for additions/removals.
+ "de", // used by Firefox multi-locale builds.
"de-AT",
"de-CH",
"de-DE",
"en-GB",
"en-US",
"en-ZA",
};
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/activitystream/homepanel/TestActivityStreamConfiguration.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/activitystream/homepanel/TestActivityStreamConfiguration.java
@@ -53,11 +53,15 @@ public class TestActivityStreamConfigura
/**
* Gets the {@link Locale} from the language tag, e.g. en-US. This duplicates
* {@link org.mozilla.gecko.Locales#parseLocaleCode(String)} which is intentional since that is not the method we're
* trying to test.
*/
private Locale getLocaleFromLanguageTag(final String tag) {
final String[] split = tag.split("-");
- return new Locale(split[0], split[1]);
+ if (split.length == 1) {
+ return new Locale(split[0]);
+ } else {
+ return new Locale(split[0], split[1]);
+ }
}
}
\ No newline at end of file