[lsc-changes] r512 - in lsc/trunk/src/main: java/org/lsc/utils resources

rschermesser at lsc-project.org rschermesser at lsc-project.org
Mon Nov 30 13:01:16 CET 2009


Author: rschermesser
Date: 2009-11-30 13:01:16 +0100 (Mon, 30 Nov 2009)
New Revision: 512

Added:
   lsc/trunk/src/main/resources/lsc_en_US
   lsc/trunk/src/main/resources/lsc_fr_FR
Modified:
   lsc/trunk/src/main/java/org/lsc/utils/I18n.java
Log:
Fixing bug in i18n and add translation files

Modified: lsc/trunk/src/main/java/org/lsc/utils/I18n.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/utils/I18n.java	2009-11-30 11:18:05 UTC (rev 511)
+++ lsc/trunk/src/main/java/org/lsc/utils/I18n.java	2009-11-30 12:01:16 UTC (rev 512)
@@ -70,14 +70,19 @@
 
 	/** The logger */
 	private static Logger LOGGER = LoggerFactory.getLogger(I18n.class);
+
 	/** The messages in the current language */
 	private ResourceBundle messages;
+
 	/** the instance */
 	private static I18n instance;
+
 	/** the current locale used to get the message */
 	private Locale currentLocale;
+
 	/** The directory containing the language specific files */
 	private static final String localeDirectory = "resources";
+
 	/** Change according the project name with the '_' character */
 	private static final String PROJECT_NAME = "lsc";
 	private static String sep = System.getProperty("file.separator");
@@ -131,10 +136,9 @@
 			lang = "en_US";
 		}
 		
-		Locale[] locales = Locale.getAvailableLocales();
-		for (int i = 0; i < locales.length; i++) {
-			if (lang.compareToIgnoreCase(locales[i].toString()) == 0) {
-				currentLocale = locales[i];
+		for(Locale locale: Locale.getAvailableLocales()) {
+			if (lang.compareToIgnoreCase(locale.toString()) == 0) {
+				currentLocale = locale;
 				break;
 			}
 		}
@@ -164,13 +168,12 @@
 		LOGGER.debug("Setting locale to {}", locale);
 		try {
 			messages = ResourceBundle.getBundle(
-							localeDirectory + sep + PROJECT_NAME,
+							PROJECT_NAME,
 							currentLocale,
 							new I18nCustomClassLoader());
 		} catch (MissingResourceException e) {
 			LOGGER.error(e.toString());
 			LOGGER.debug(e.toString(), e);
-			LOGGER.debug(System.getenv("CLASSPATH"));
 			throw e;
 		}
 	}

Added: lsc/trunk/src/main/resources/lsc_en_US
===================================================================
--- lsc/trunk/src/main/resources/lsc_en_US	                        (rev 0)
+++ lsc/trunk/src/main/resources/lsc_en_US	2009-11-30 12:01:16 UTC (rev 512)
@@ -0,0 +1,8 @@
+org.lsc.messages.ADD_ENTRY = \# Adding new entry {0} for {1} 
+org.lsc.messages.RENAME_ENTRY = \# Renaming entry {0} for {1}
+org.lsc.messages.REMOVE_ENTRY = \# Removing entry {0} for {1} 
+org.lsc.messages.UPDATE_ENTRY = \# Updating entry {0} for {1} 
+org.lsc.messages.UNKNOWN_CHANGETYPE = Error: unknown changetype ({0} for {1})
+org.lsc.messages.NB_CHANGES = \# All entries: {0}, to modify entries: {1}, modified entries: {2}, errors: {3}
+org.lsc.messages.SYNC_ERROR = Error while synchronizing ID {0}: {1}\n{2}
+

Added: lsc/trunk/src/main/resources/lsc_fr_FR
===================================================================
--- lsc/trunk/src/main/resources/lsc_fr_FR	                        (rev 0)
+++ lsc/trunk/src/main/resources/lsc_fr_FR	2009-11-30 12:01:16 UTC (rev 512)
@@ -0,0 +1,7 @@
+org.lsc.messages.ADD_ENTRY = \# Ajout du nouvel enregistrement {0} pour {1} 
+org.lsc.messages.RENAME_ENTRY = \# Renommage de l'enregistrement {0} pour {1} 
+org.lsc.messages.REMOVE_ENTRY = \# Retrait de l'enregistrement {0} pour {1} 
+org.lsc.messages.UPDATE_ENTRY = \# Mise à jour de l'enregistrement {0} pour {1} 
+org.lsc.messages.UNKNOWN_CHANGETYPE = Erreur: type de changement inconnu ({0} pour {1})
+org.lsc.messages.NB_CHANGES = \# Nombre d'enregistrement(s) pris en compte: {0}, nombre d'enregistrement(s) à reporter: {1}, nombre d'enregistrements reporté(s): {2}, nombre d'erreurs: {3}
+org.lsc.messages.SYNC_ERROR = Erreur rencontrée sur l'identifiant {0}: {1}\n{2}



More information about the lsc-changes mailing list