Class ConfigI18nLocalizationService
java.lang.Object
org.openhab.core.config.core.i18n.ConfigI18nLocalizationService
This OSGi service could be used to localize a config description using the I18N mechanism of the openHAB
framework.
- Author:
- Markus Rathgeb - Initial contribution
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetLocalizedConfigDescription(org.osgi.framework.Bundle bundle, ConfigDescription configDescription, @Nullable Locale locale) Localize a config description.getLocalizedConfigDescriptionGroup(org.osgi.framework.Bundle bundle, URI configDescriptionURI, ConfigDescriptionParameterGroup group, @Nullable Locale locale) Localize a config description parameter group.getLocalizedConfigDescriptionGroup(org.osgi.framework.Bundle bundle, ConfigDescription configDescription, ConfigDescriptionParameterGroup group, @Nullable Locale locale) Localize a config description parameter group.getLocalizedConfigDescriptionParameter(org.osgi.framework.Bundle bundle, URI configDescriptionURI, ConfigDescriptionParameter parameter, @Nullable Locale locale) Localize a config description parameter.getLocalizedConfigDescriptionParameter(org.osgi.framework.Bundle bundle, ConfigDescription configDescription, ConfigDescriptionParameter parameter, @Nullable Locale locale) Localize a config description parameter.getLocalizedOptions(List<ParameterOption> originalOptions, org.osgi.framework.Bundle bundle, URI configDescriptionURI, String parameterName, @Nullable Locale locale) Localize parameter options.
-
Constructor Details
-
ConfigI18nLocalizationService
-
-
Method Details
-
getLocalizedConfigDescription
public ConfigDescription getLocalizedConfigDescription(org.osgi.framework.Bundle bundle, ConfigDescription configDescription, @Nullable Locale locale) Localize a config description.- Parameters:
bundle- the bundle the i18n resources are locatedconfigDescription- the config description that should be localizedlocale- the locale it should be localized to- Returns:
- a localized configuration description on success, a non-localized one on error (e.g. no translation is found).
-
getLocalizedConfigDescriptionParameter
public ConfigDescriptionParameter getLocalizedConfigDescriptionParameter(org.osgi.framework.Bundle bundle, ConfigDescription configDescription, ConfigDescriptionParameter parameter, @Nullable Locale locale) Localize a config description parameter.- Parameters:
bundle- the bundle the i18n resources are locatedconfigDescription- the config description the parameter is part ofparameter- the parameter that should be localizedlocale- the locale it should be localized to- Returns:
- a localized parameter on success, a non-localized one on error (e.g. no translation is found).
-
getLocalizedConfigDescriptionParameter
public ConfigDescriptionParameter getLocalizedConfigDescriptionParameter(org.osgi.framework.Bundle bundle, URI configDescriptionURI, ConfigDescriptionParameter parameter, @Nullable Locale locale) Localize a config description parameter.- Parameters:
bundle- the bundle the i18n resources are locatedconfigDescriptionURI- the config description URIparameter- the parameter that should be localizedlocale- the locale it should be localized to- Returns:
- a localized parameter on success, a non-localized one on error (e.g. no translation is found).
-
getLocalizedConfigDescriptionGroup
public ConfigDescriptionParameterGroup getLocalizedConfigDescriptionGroup(org.osgi.framework.Bundle bundle, ConfigDescription configDescription, ConfigDescriptionParameterGroup group, @Nullable Locale locale) Localize a config description parameter group.- Parameters:
bundle- the bundle the i18n resources are locatedconfigDescription- the config description the parameter group is part ofgroup- the parameter group that should be localizedlocale- the locale it should be localized to- Returns:
- a localized parameter group on success, a non-localized one on error (e.g. no translation is found).
-
getLocalizedConfigDescriptionGroup
public ConfigDescriptionParameterGroup getLocalizedConfigDescriptionGroup(org.osgi.framework.Bundle bundle, URI configDescriptionURI, ConfigDescriptionParameterGroup group, @Nullable Locale locale) Localize a config description parameter group.- Parameters:
bundle- the bundle the i18n resources are locatedconfigDescriptionURI- the config description URIgroup- the parameter group that should be localizedlocale- the locale it should be localized to- Returns:
- a localized parameter group on success, a non-localized one on error (e.g. no translation is found).
-
getLocalizedOptions
public List<ParameterOption> getLocalizedOptions(List<ParameterOption> originalOptions, org.osgi.framework.Bundle bundle, URI configDescriptionURI, String parameterName, @Nullable Locale locale) Localize parameter options.- Parameters:
originalOptions- the parameter options that should be localizedbundle- the bundle the i18n resources are locatedconfigDescriptionURI- the config description URIparameterName- the name of the parameterlocale- the locale it should be localized to- Returns:
- a list with parameter option. If an option could not be localized (e.g. no translation is found), the non-localized one is added to the list.
-