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
This commit is contained in:
Olivier Lamy 2012-01-09 09:00:43 +00:00
parent 9d782683a9
commit a2123c92c8
2 changed files with 12 additions and 7 deletions

View 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

View 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", {cache:false, mode: 'map',encoding:'utf-8'});
//if (browserLang!='en'){
loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang, {cache:false, mode: 'map',encoding:'utf-8'});
}
//}
});