Revision 38094

View differences:

branches/v2_0_0_prep/extensions/extI18n/src/main/java/org/gvsig/i18n/impl/I18nManagerImpl.java
54 54

  
55 55
import org.gvsig.andami.Launcher;
56 56
import org.gvsig.andami.PluginServices;
57
import org.gvsig.andami.PluginsLocator;
57 58
import org.gvsig.andami.config.generate.AndamiConfig;
58 59
import org.gvsig.i18n.I18nException;
59 60
import org.gvsig.i18n.I18nManager;
......
69 70
 */
70 71
public class I18nManagerImpl implements I18nManager {
71 72

  
72
	private static final String LOCALES_FILE_NAME = "locales.csv";
73
    private static final String INSTALLED_TRANSLATIONS_HOME_FOLDER = "i18n";
73 74

  
75
    private static final String LOCALES_FILE_NAME = "locales.csv";
76

  
74 77
	private static final String CSV_SEPARATOR = ",";
75 78

  
76 79
	private static final String I18N_EXTENSION = "org.gvsig.i18n.extension";
......
717 720
	/**
718 721
	 * Returns the folder where to store the resource bundle files.
719 722
	 */
720
	private File getResourcesFolder() {
721
        return PluginServices.getPluginServices("org.gvsig.app")
722
				.getPluginDirectory();
723
	}
723
    private File getResourcesFolder() {
724
        File i18nFolder =
725
            new File(PluginsLocator.getManager().getApplicationHomeFolder(),
726
                INSTALLED_TRANSLATIONS_HOME_FOLDER);
727
        if (!i18nFolder.exists()) {
728
            i18nFolder.mkdirs();
729
        }
730
        return i18nFolder;
731
    }
724 732

  
725 733
	/**
726 734
	 * Returns the child XMLEntity with the RegisteredLocales.
branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/Launcher.java
66 66
import java.net.MalformedURLException;
67 67
import java.net.PasswordAuthentication;
68 68
import java.net.URL;
69
import java.net.URLClassLoader;
69 70
import java.nio.channels.FileChannel;
70 71
import java.security.AllPermission;
71 72
import java.security.CodeSource;
......
107 108
import org.apache.log4j.spi.LoggingEvent;
108 109
import org.exolab.castor.xml.MarshalException;
109 110
import org.exolab.castor.xml.ValidationException;
111
import org.slf4j.Logger;
112
import org.slf4j.LoggerFactory;
113

  
110 114
import org.gvsig.andami.authentication.IAuthentication;
111 115
import org.gvsig.andami.authentication.LoginUI;
112 116
import org.gvsig.andami.config.generate.Andami;
......
162 166
import org.gvsig.utils.XMLEntity;
163 167
import org.gvsig.utils.xml.XMLEncodingUtils;
164 168
import org.gvsig.utils.xmlEntity.generate.XmlTag;
165
import org.slf4j.Logger;
166
import org.slf4j.LoggerFactory;
167 169

  
168 170
/**
169 171
 * <p>
......
2508 2510
			org.gvsig.i18n.Messages.addLocale(new Locale("en"));
2509 2511
			org.gvsig.i18n.Messages.addLocale(new Locale("es"));
2510 2512
		}
2511
		org.gvsig.i18n.Messages.addResourceFamily("org.gvsig.andami.text",
2512
				"org.gvsig.andami.text");
2513 2513

  
2514
        // Create classloader for the i18n resources in the
2515
        // andami and user i18n folder. Those values will have
2516
        // precedence over any other values added afterwards
2517
        File andamiI18nFolder =
2518
            new File(System.getProperty("user.dir"), "i18n");
2519
        File userI18nFolder = new File(getAppHomeDir(), "i18n");
2520

  
2521
        logger.info("Loading i18n resources from the application and user "
2522
            + "folders: {}, {}", andamiI18nFolder, userI18nFolder);
2523

  
2524
        URL[] i18nURLs;
2525
        try {
2526
            i18nURLs =
2527
                new URL[] { userI18nFolder.toURI().toURL(),
2528
                    andamiI18nFolder.toURI().toURL() };
2529
            ClassLoader i18nClassLoader = new URLClassLoader(i18nURLs);
2530
            org.gvsig.i18n.Messages.addResourceFamily("text", i18nClassLoader,
2531
                "Andami Launcher");
2532
        } catch (MalformedURLException e) {
2533
            logger.error("Error loading i18n resources from the application "
2534
                + "and user folders: " + andamiI18nFolder + ", "
2535
                + userI18nFolder, e);
2536
        }
2537

  
2538
        // Finally load the andami own i18n resources
2539
        org.gvsig.i18n.Messages.addResourceFamily("org.gvsig.andami.text",
2540
            "Andami Launcher");
2514 2541
	}
2515 2542

  
2516 2543
	/**

Also available in: Unified diff