Add a way to create an empty SoyMsgBundle for any locale
this is useful for testing
GITHUB_BREAKING_CHANGES=none
@@ -93,18 +93,20 @@ public abstract class SoyMsgBundle implements Iterable<SoyMsg> {
// Null object.
/** Null object for SoyMsgBundle, assumes English Locale. */
- public static final SoyMsgBundle EMPTY =
- new SoyMsgBundle() {
+ public static final SoyMsgBundle EMPTY = empty(ULocale.ENGLISH);
+
+ public static SoyMsgBundle empty(ULocale locale) {
+ return new SoyMsgBundle() {
@Override
public String getLocaleString() {
- return "en";
+ return locale.toString();
}
@Override
@Nullable
public ULocale getLocale() {
- return ULocale.ENGLISH;
+ return locale;
}
@Override
@@ -133,3 +135,4 @@ public abstract class SoyMsgBundle implements Iterable<SoyMsg> {
}
};
}
+}
