Thursday, June 20, 2013

How to load the Resource Bundle based on client logged in Locale ?

How to load the Resource Bundle based on client logged in Locale ?


  /**
  * Load Resource Bundle based on client Locale
  **/
  private void loadBundle(Locale locale)
  {
    Map<Locale, PropertyResourceBundle> mBundles =
    new HashMap<Locale, PropertyResourceBundle>();
      synchronized(locale)
      {
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        PropertyResourceBundle bundle =
          (PropertyResourceBundle)PropertyResourceBundle.getBundle(sMessageBundleName, locale, classLoader);
        mBundles.put(locale, bundle);
      }
  }

No comments:

Post a Comment