diff options
author | Martin Stockhammer <martin_s@apache.org> | 2017-10-25 22:59:26 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2017-10-25 22:59:26 +0200 |
commit | 89f7aa34163023e5d2c2f388baabc3683268418f (patch) | |
tree | 12552a23a7a389a44a4a95c07a738b0c56212ce6 /archiva-modules | |
parent | 1026c8eeb87b393f2a259b10d56a366ba1b523e9 (diff) | |
download | archiva-89f7aa34163023e5d2c2f388baabc3683268418f.tar.gz archiva-89f7aa34163023e5d2c2f388baabc3683268418f.zip |
Adding language settings to configuration
Diffstat (limited to 'archiva-modules')
3 files changed, 45 insertions, 2 deletions
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java index 4f6798c10..02d2b1362 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/ArchivaConfiguration.java @@ -22,6 +22,9 @@ package org.apache.archiva.configuration; 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. */ @@ -85,5 +88,9 @@ public interface ArchivaConfiguration * @since 1.4-M1 */ void reload(); + + public Locale getDefaultLocale(); + + public List<Locale.LanguageRange> getLanguagePriorities(); } diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index 1dd0baeb2..6983be0ac 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -63,6 +63,7 @@ import java.util.HashMap; 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; @@ -169,6 +170,15 @@ public class DefaultArchivaConfiguration // 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() { @@ -341,8 +351,8 @@ public class DefaultArchivaConfiguration } } - - + this.defaultLocale = Locale.forLanguageTag( config.getArchivaRuntimeConfiguration().getDefaultLanguage() ); + this.languagePriorities = Locale.LanguageRange.parse(config.getArchivaRuntimeConfiguration().getLanguageRange()); return config; } @@ -870,6 +880,18 @@ public class DefaultArchivaConfiguration } @Override + public Locale getDefaultLocale( ) + { + return defaultLocale; + } + + @Override + public List<Locale.LanguageRange> getLanguagePriorities( ) + { + return languagePriorities; + } + + @Override public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue ) { // nothing to do here diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index d5d96cda3..b6acf5366 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -465,6 +465,7 @@ <name>indexDir</name> <version>1.0.0+</version> <type>String</type> + <defaultValue></defaultValue> <description> The directory for the indexes of this repository. </description> @@ -473,6 +474,7 @@ <name>description</name> <version>1.0.0+</version> <type>String</type> + <defaultValue></defaultValue> <description> The description of this repository. </description> @@ -1544,6 +1546,18 @@ <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> |