mirror of https://github.com/apache/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
This commit is contained in:
parent
9d782683a9
commit
a2123c92c8
|
@ -83,7 +83,7 @@ public class DefaultCommonServices
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String fromProperties( Properties properties )
|
private String fromProperties( final Properties properties )
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
|
@ -96,17 +96,22 @@ public class DefaultCommonServices
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadResource( Properties properties, String resourceName )
|
private void loadResource( final Properties finalProperties, String resourceName )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
|
Properties properties = new Properties();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
is = Thread.currentThread().getContextClassLoader().getResourceAsStream( resourceName.toString() );
|
is = Thread.currentThread().getContextClassLoader().getResourceAsStream( resourceName.toString() );
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
{
|
{
|
||||||
properties.load( is );
|
properties.load( is );
|
||||||
|
finalProperties.putAll( properties );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.info( "cannot load resource {}", resourceName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -28,8 +28,8 @@ $(function() {
|
||||||
$.log("use browserLang:"+browserLang);
|
$.log("use browserLang:"+browserLang);
|
||||||
// -- archiva
|
// -- archiva
|
||||||
// load default
|
// load default
|
||||||
loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources", {cache:false, mode: 'map',encoding:'utf-8'});
|
//loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources", {cache:false, mode: 'map',encoding:'utf-8'});
|
||||||
if (browserLang!='en'){
|
//if (browserLang!='en'){
|
||||||
loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang, {cache:false, mode: 'map',encoding:'utf-8'});
|
loadAndParseFile("restServices/archivaServices/commonServices/getAllI18nResources?locale="+browserLang, {cache:false, mode: 'map',encoding:'utf-8'});
|
||||||
}
|
//}
|
||||||
});
|
});
|
Loading…
Reference in New Issue