Bug 1405404: Add 'de' to list of pocket whitelisted locales. r=liuche draft
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 03 Oct 2017 10:29:49 -0700
changeset 674394 3f92c5f3cbefbb7cea14a1f673edce546a640a96
parent 674354 511af079fcdaf809974cdb6b7051affba450db0d
child 734315 367379bdb9d52d2b39ae727f3678bd30441d0757
push id82821
push usermichael.l.comella@gmail.com
push dateTue, 03 Oct 2017 18:20:30 +0000
reviewersliuche
bugs1405404
milestone58.0a1
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
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/ActivityStreamConfiguration.java
mobile/android/tests/background/junit4/src/org/mozilla/gecko/activitystream/homepanel/TestActivityStreamConfiguration.java
--- 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