]> source.dussan.org Git - archiva.git/commitdiff
load all i18n in only one rest call
authorOlivier Lamy <olamy@apache.org>
Mon, 9 Jan 2012 09:00:43 +0000 (09:00 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 9 Jan 2012 09:00:43 +0000 (09:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1229063 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js

index b768807fdfbfc9b43b7e307559fe0bd5ff541caf..2400e0ce49fe20d4a976ef0b6622a09bd949e066 100644 (file)
@@ -83,7 +83,7 @@ public class DefaultCommonServices
 
     }
 
-    private String fromProperties( Properties properties )
+    private String fromProperties( final Properties properties )
     {
         StringBuilder output = new StringBuilder();
 
@@ -96,17 +96,22 @@ public class DefaultCommonServices
         return output.toString();
     }
 
-    private void loadResource( Properties properties, String resourceName )
+    private void loadResource( final Properties finalProperties, String resourceName )
         throws IOException
     {
         InputStream is = null;
-
+        Properties properties = new Properties();
         try
         {
             is = Thread.currentThread().getContextClassLoader().getResourceAsStream( resourceName.toString() );
             if ( is != null )
             {
                 properties.load( is );
+                finalProperties.putAll( properties );
+            }
+            else
+            {
+                log.info( "cannot load resource {}", resourceName );
             }
         }
         finally
index b32097f0750482c4f3a110c4a31498c3dc799130..ae9daaf13f7b56759bf839b2e832890686b77146 100644 (file)
@@ -28,8 +28,8 @@ $(function() {
   $.log("use browserLang:"+browserLang);
   // -- archiva
   // load default
-  loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources", {cache:false, mode: 'map',encoding:'utf-8'});
-  if (browserLang!='en'){
-    loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang, {cache:false, mode: 'map',encoding:'utf-8'});
-  }
+  //loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources", {cache:false, mode: 'map',encoding:'utf-8'});
+  //if (browserLang!='en'){
+  loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang, {cache:false, mode: 'map',encoding:'utf-8'});
+  //}
 });
\ No newline at end of file