Revision 42761

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.i18n/src/main/java/org/gvsig/i18n/Messages.java
100 100
	private static Set resourceFamilies = new HashSet();
101 101
	private static Set classLoaders = new HashSet();
102 102

  
103
        private static List familyDescriptors = new ArrayList();
103
        private static List<FamilyDescriptor> familyDescriptors = new ArrayList<>();
104 104
        
105 105
	/*
106 106
	 * The language considered the origin of translations, which will
......
356 356
	 *
357 357
	 * @param family    The family name (or base name) which is used to search
358 358
	 *                  actual properties files.
359
	 * @param dir       The search path to locate the property files
359
	 * @param folder       The search path to locate the property files
360 360
	 * @throws MalformedURLException
361 361
	 * @see             <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/ResourceBundle.html">ResourceBundle</a>
362 362
	 */
363
	public static void addResourceFamily(String family, File dir) throws MalformedURLException{
363
	public static void addResourceFamily(String family, File folder) throws MalformedURLException{
364 364
		// use our own classloader
365
		URL[] urls = new URL[1];
366
		urls[0] = dir.toURL();
365
		URL[] urls = new URL[] { folder.toURI().toURL() };
367 366
		ClassLoader loader = new MessagesClassLoader(urls);
368
		addResourceFamily(family, loader, "");
367
                for (FamilyDescriptor familyDescriptor : familyDescriptors) {
368
                    if( familyDescriptor.callerName.equals(folder.getAbsolutePath()) &&
369
                        familyDescriptor.family.equals(family) ) {
370
                        // Already added
371
                        return;
372
                    }
373
                }
374
		addResourceFamily(family, loader, folder.getAbsolutePath());
369 375
	}
370 376

  
371 377

  
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.i18n/src/main/java/org/gvsig/i18n/tools/impl/DefaultI18Manager.java
23 23
 */
24 24
package org.gvsig.i18n.tools.impl;
25 25

  
26
import java.io.File;
27
import java.net.MalformedURLException;
26 28
import java.util.Locale;
29
import java.util.logging.Level;
30
import java.util.logging.Logger;
27 31

  
28 32
import org.gvsig.i18n.Messages;
29 33
import org.gvsig.tools.i18n.I18nManager;
......
54 58
		Messages.addResourceFamily(family, loader, callerName);
55 59
	}
56 60

  
61
        public void addResourceFamily(String family, File folder) {
62
            if (!Messages.hasLocales()) {
63
                Messages.addLocale(Locale.getDefault());
64
            }
65
            try {
66
                Messages.addResourceFamily(family, folder);
67
            } catch (MalformedURLException ex) {
68
                throw new RuntimeException(ex);
69
            }
70
        }
57 71
}

Also available in: Unified diff