Index: lutinutil/src/java/org/codelutin/i18n/Language.java diff -u lutinutil/src/java/org/codelutin/i18n/Language.java:1.13 lutinutil/src/java/org/codelutin/i18n/Language.java:1.14 --- lutinutil/src/java/org/codelutin/i18n/Language.java:1.13 Sun Mar 23 06:02:24 2008 +++ lutinutil/src/java/org/codelutin/i18n/Language.java Sun Mar 23 21:11:19 2008 @@ -40,35 +40,12 @@ /** * This class is used by the i18n class. It encapsulates the translation * resource for a given language and a given encoding. - *

- * The class offers a public static factory method : - * {@link #newLanguage(Locale, String)}. - *

- * Note : You SHOULD always use the factory method, since constructor does - * not load i18n bundle resources. */ public class Language { /** to use log facility, just put in your code: log.info(\"...\"); */ private static final Log log = LogFactory.getLog(Language.class); - /** - * Instancie un nouveau language et l'initialie avec ses traductions pour - * la locale sous-jacente. - *

- * Note : ne pas utilisé directement le constructeur, sinon la langue n'est - * pas initilisé avec les traductions des bundles. - * - * @param l la locale choisie - * @param toEncoding l'encoding choisi - * @return l'instance du language correspondant, initialisé - */ - public static Language newLanguage(Locale l, String toEncoding) { - Language language = new Language(l, toEncoding); - language.init(); - return language; - } - public static URLClassLoader getLoader() { ClassLoader loader = Language.class.getClassLoader(); if (loader instanceof URLClassLoader) { @@ -86,7 +63,7 @@ /** l'encoding */ protected String encoding; - protected Language(Locale l, String toEncoding) { + public Language(Locale l, String toEncoding) { this.locale = l; this.encoding = toEncoding; } @@ -95,14 +72,20 @@ * charge les traductions de la langue. *

* recherche dans un premier temps, les urls des bundles puis les charge. + * + * @param bundleManager the used bundle manager */ - protected void init() { + public void load(I18nBundleManager bundleManager) { // make sure the bundlemanager is init - I18nBundleManager.init(); + bundleManager.init(); // load resources from bundles resource = new Properties(); // get bundles for this locale - I18nBundleManager.getInstance().load(this, resource); + try { + bundleManager.load(this, resource); + } catch (IOException e) { + throw new RuntimeException(e); + } } /**