Browse Source

Merge "Enable NLS / TranslationBundle to be used in OSGi"

stable-3.5
Robin Rosenberg 11 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
be025ff7d2
  1. 16
      org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java

16
org.eclipse.jgit/src/org/eclipse/jgit/nls/TranslationBundle.java

@ -99,8 +99,8 @@ import org.eclipse.jgit.errors.TranslationStringMissingException;
* {@link ResourceBundle#getBundle(String, Locale)} method to load a resource * {@link ResourceBundle#getBundle(String, Locale)} method to load a resource
* bundle. See the documentation of this method for a detailed explanation of * bundle. See the documentation of this method for a detailed explanation of
* resource bundle loading strategy. After a bundle is created the * resource bundle loading strategy. After a bundle is created the
* {@link #effectiveLocale()} method can be used to determine whether the * {@link #effectiveLocale()} method can be used to determine whether the bundle
* bundle really corresponds to the requested locale or is a fallback. * really corresponds to the requested locale or is a fallback.
* *
* <p> * <p>
* To load a String from a resource bundle property file this class uses the * To load a String from a resource bundle property file this class uses the
@ -153,13 +153,17 @@ public abstract class TranslationBundle {
* *
* @param locale * @param locale
* defines the locale to be used when loading the resource bundle * defines the locale to be used when loading the resource bundle
* @exception TranslationBundleLoadingException see {@link TranslationBundleLoadingException} * @exception TranslationBundleLoadingException
* @exception TranslationStringMissingException see {@link TranslationStringMissingException} * see {@link TranslationBundleLoadingException}
* @exception TranslationStringMissingException
* see {@link TranslationStringMissingException}
*/ */
void load(Locale locale) throws TranslationBundleLoadingException { void load(Locale locale)
throws TranslationBundleLoadingException {
Class bundleClass = getClass(); Class bundleClass = getClass();
try { try {
resourceBundle = ResourceBundle.getBundle(bundleClass.getName(), locale); resourceBundle = ResourceBundle.getBundle(bundleClass.getName(),
locale, bundleClass.getClassLoader());
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
throw new TranslationBundleLoadingException(bundleClass, locale, e); throw new TranslationBundleLoadingException(bundleClass, locale, e);
} }

Loading…
Cancel
Save