From: Olivier Lamy Date: Mon, 9 Jan 2012 09:00:43 +0000 (+0000) Subject: load all i18n in only one rest call X-Git-Tag: archiva-1.4-M3~1625 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a2123c92c8a3fccd6b946148f5648573537c0127;p=archiva.git load all i18n in only one rest call git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1229063 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java index b768807fd..2400e0ce4 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java @@ -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 diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js index b32097f07..ae9daaf13 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/i18nload.js @@ -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