コード例 #1
0
 /**
  * Returns the Default Resource Bundle (JiraWebActionSupport.properties) for the given locale.
  *
  * @param locale The locale.
  * @return the Default Resource Bundle (JiraWebActionSupport.properties) for the given locale.
  */
 public static ResourceBundle getDefaultResourceBundle(final Locale locale) {
   ResourceBundle resourceBundle = resourceBundleMap.get(locale);
   if (resourceBundle == null) {
     if (JiraSystemProperties.isI18nReloadBundles()) {
       //
       // in dev mode we want to use a resource bundle that can reload itself if the underlying
       // file changes
       // so we use our own home grown ResourceBundle.  This guy is reasonable efficient and its
       // only used
       // in dev mode anyways
       //
       resourceBundle =
           DebuggingResourceBundle.getDebuggingResourceBundle(
               DEFAULT_RESOURCE_BUNDLE_NAME, locale);
     }
     if (resourceBundle == null) {
       // The default resource bundle must live in the standard class loader because it holds
       // translations for core JIRA.
       resourceBundle = ResourceBundle.getBundle(DEFAULT_RESOURCE_BUNDLE_NAME, locale);
     }
     final ResourceBundle result = resourceBundleMap.putIfAbsent(locale, resourceBundle);
     return (result == null) ? resourceBundle : result;
   }
   return resourceBundle;
 }
コード例 #2
0
 /**
  * Returns <tt>true</tt> if and only if the default resource bundle data is stale for the given
  * locale. This is used by <tt>I18nBean.CachingFactory</tt> to flush the cache when the default
  * resource bundle is modified. This is only relevant in dev mode, as otherwise we will not have a
  * <tt>DebuggingResourceBundle</tt> and so can not reload it anyway.
  *
  * @param locale the locale within which to make the check
  * @return <tt>true</tt> if the data has to be reloaded; <tt>false</tt> otherwise.
  */
 public static boolean isDefaultResourceBundleStale(final Locale locale) {
   ResourceBundle resourceBundle = resourceBundleMap.get(locale);
   return resourceBundle instanceof DebuggingResourceBundle
       && ((DebuggingResourceBundle) resourceBundle).isStale();
 }