code: public static SoyMsgBundle preservingLocaleIfAllowed(SoyMsgBundle bundle, Locale locale) {
      // When checking compatibility, normalize the locale using toLanguageTag() to convert deprecated
      // locale language codes ("iw") to new ones ("he"). Thus, for backward compatiblity, we thus
      // avoid wrapping the original bundle when its language code isn't preserved.
      ULocale ulocale = new ULocale(locale.toLanguageTag());
      return ulocale.getLanguage().equals(bundle.getLocale().getLanguage())
          ? new SoyMsgBundleWithFullLocale(bundle, ulocale, ulocale.toLanguageTag())
          : bundle;
    }
docs: Returns a soy message bundle that exposes `locale` as its locale IF `locale` corresponds to the
  same language as `bundle.getLocale()`. Intuitively, the returned bundle retains the passed-in
  locale if it's compatible with the passed-in translation bundle.
  
  <p>Examples
  
  <ul>
  <li>If our translation bundle includes "es-419" (Spanish Latin America) but not "es-MX"
  (Spanish Mexico) specifically, then the returned bundle would use the translations for
  "es-419", but still expose "es-MX" as its locale to soy plugins for accurate
  localization.
  <li>If, for a completely unsupported language, the passed-in bundle is the default one with
  "en" locale, then the returned bundle exposes "en" for localization.
  </ul>