import org.apache.archiva.redback.components.registry.RegistryException;
import org.apache.archiva.redback.components.registry.RegistryListener;
+import java.util.List;
+import java.util.Locale;
+
/**
* Configuration holder for the model read from the registry.
*/
* @since 1.4-M1
*/
void reload();
+
+ public Locale getDefaultLocale();
+
+ public List<Locale.LanguageRange> getLanguagePriorities();
}
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
// Section used for default only configuration
private static final String KEY_DEFAULT_ONLY = "org.apache.archiva_default";
+ private Locale defaultLocale = Locale.getDefault();
+
+ private List<Locale.LanguageRange> languagePriorities = new ArrayList<>( );
+
+ @PostConstruct
+ private void init() {
+ languagePriorities = Locale.LanguageRange.parse( "en,fr,de" );
+ }
+
@Override
public Configuration getConfiguration()
{
}
}
-
-
+ this.defaultLocale = Locale.forLanguageTag( config.getArchivaRuntimeConfiguration().getDefaultLanguage() );
+ this.languagePriorities = Locale.LanguageRange.parse(config.getArchivaRuntimeConfiguration().getLanguageRange());
return config;
}
this.initialize();
}
+ @Override
+ public Locale getDefaultLocale( )
+ {
+ return defaultLocale;
+ }
+
+ @Override
+ public List<Locale.LanguageRange> getLanguagePriorities( )
+ {
+ return languagePriorities;
+ }
+
@Override
public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
{
<name>indexDir</name>
<version>1.0.0+</version>
<type>String</type>
+ <defaultValue></defaultValue>
<description>
The directory for the indexes of this repository.
</description>
<name>description</name>
<version>1.0.0+</version>
<type>String</type>
+ <defaultValue></defaultValue>
<description>
The description of this repository.
</description>
<type>String</type>
<required>false</required>
</field>
+ <field>
+ <name>defaultLanguage</name>
+ <type>String</type>
+ <version>3.0.0+</version>
+ <description>The default language used for setting internationalized strings.</description>
+ </field>
+ <field>
+ <name>languageRange</name>
+ <type>String</type>
+ <version>3.0.0+</version>
+ <description>Comma separated list of language patterns. Sorted by priority descending. Used for display of internationalized strings.</description>
+ </field>
</fields>
</class>