Interface ILocalizationProviding<TBase extends de.xima.cmn.dao.interfaces.IEntity<Long>,TLocale extends ILocalization<TBase>>
-
- Type Parameters:
TBase
- type of the base entity that is providing localization.TLocale
- type of the localization.
- All Known Implementing Classes:
ClientPortalConfig
,Projekt
,UserPortal
,UserPortalAuthConfig
,UserPortalState
,UserPortalTag
public interface ILocalizationProviding<TBase extends de.xima.cmn.dao.interfaces.IEntity<Long>,TLocale extends ILocalization<TBase>>
Common interface for all objects (mainly entities) that have got localisation entities for the purpose of internationalisation.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_LOCALIZATIONS
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Locale
getFallbackLocale()
Gets the default locale to use as a fallback when a localization is missing for a locale.default Set<String>
getI18nNames()
Gets the i18n names provided by this object.default String
getLocalization(String i18nName, Locale locale)
Gets the localized string for the given I18N name and locale.default String
getLocalization(String i18nName, Locale locale, Locale fallbackLocale)
Gets the localized string for the given I18N name and locale.default TLocale
getLocalizationObject(String i18nName, Locale locale)
Gets the localization object for the given I18N name and locale.default TLocale
getLocalizationObject(String i18nName, Locale locale, Locale fallbackLocale)
Gets the localization object for the given I18N name and locale.List<TLocale>
getLocalizations()
Gets the localisation entitiesdefault Map<String,Map<Locale,String>>
getLocalizationsByI18nName()
Gets the localizations grouped by the I18N name (map key).default Map<Locale,String>
getLocalizationsByI18nName(String i18nName)
Gets the localizations for the given I18N name.default Map<Locale,String>
getLocalizationsByI18nName(String i18nName, Locale fallbackLocale)
Gets the localizations for the given I18N name.default Map<String,Map<Locale,String>>
getLocalizationsByI18nName(Locale fallbackLocale)
Gets the localizations grouped by the I18N name (map key).default Map<Locale,Map<String,String>>
getLocalizationsByLocale()
Gets the localizations grouped by the locale (map key).default Map<Locale,Map<String,String>>
getLocalizationsByLocale(Locale fallbackLocale)
Gets the localizations grouped by the locale (map key).default Map<String,String>
getLocalizationsForLocale(Locale locale)
Gets the localizations for the given locale.default Map<String,String>
getLocalizationsForLocale(Locale locale, Locale fallbackLocale)
Gets the localizations for the given locale.void
setLocalizations(List<TLocale> entities)
Sets the i18n name
-
-
-
Field Detail
-
ATTR_LOCALIZATIONS
static final String ATTR_LOCALIZATIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocalizations
List<TLocale> getLocalizations()
Gets the localisation entities- Returns:
- the localisation entities
-
setLocalizations
void setLocalizations(List<TLocale> entities)
Sets the i18n name- Parameters:
entities
- the entities for localisation to set
-
getFallbackLocale
Locale getFallbackLocale()
Gets the default locale to use as a fallback when a localization is missing for a locale. May return null if the object does not provide a fallback locale.- Returns:
- the default locale to use as a fallback when a localization is missing for a locale
-
getLocalizationsByI18nName
default Map<String,Map<Locale,String>> getLocalizationsByI18nName()
Gets the localizations grouped by the I18N name (map key).- Returns:
- the localizations grouped by the I18N name (map key) as an immutable map.
-
getLocalizationsByLocale
default Map<Locale,Map<String,String>> getLocalizationsByLocale()
Gets the localizations grouped by the locale (map key).- Returns:
- the localizations grouped by the locale (map key) as an immutable map.
-
getI18nNames
default Set<String> getI18nNames()
Gets the i18n names provided by this object.- Returns:
- the i18n names provided by this object
-
getLocalizationsByI18nName
default Map<String,Map<Locale,String>> getLocalizationsByI18nName(Locale fallbackLocale)
Gets the localizations grouped by the I18N name (map key).- Parameters:
fallbackLocale
- to get the localizations from if a localization is missing for a locale- Returns:
- the localizations grouped by the I18N name (map key) as an immutable map.
-
getLocalizationsByI18nName
default Map<Locale,String> getLocalizationsByI18nName(String i18nName)
Gets the localizations for the given I18N name.- Parameters:
i18nName
- to get the localizations for- Returns:
- the localizations for the given I18N name as an immutable map.
-
getLocalizationsByI18nName
default Map<Locale,String> getLocalizationsByI18nName(String i18nName, Locale fallbackLocale)
Gets the localizations for the given I18N name.- Parameters:
i18nName
- to get the localizations forfallbackLocale
- to get the localizations from if the localization for the given locale is missing- Returns:
- the localizations for the given I18N name as an immutable map.
-
getLocalizationsByLocale
default Map<Locale,Map<String,String>> getLocalizationsByLocale(Locale fallbackLocale)
Gets the localizations grouped by the locale (map key). Uses the messages from the given fallback locale when a message is missing for the given locale.- Parameters:
fallbackLocale
- to get the localizations from if a localization is missing for a locale- Returns:
- the localizations grouped by the locale (map key) as an immutable map.
-
getLocalizationsForLocale
default Map<String,String> getLocalizationsForLocale(Locale locale)
Gets the localizations for the given locale.- Parameters:
locale
- to get the localizations for.- Returns:
- the localizations for the given locale as an immutable map.
-
getLocalizationsForLocale
default Map<String,String> getLocalizationsForLocale(Locale locale, Locale fallbackLocale)
Gets the localizations for the given locale. Uses the messages from the given fallback locale when a message is missing for the given locale.- Parameters:
locale
- to get the localizations for.fallbackLocale
- to get the localizations from if the localization for the given locale is missing- Returns:
- the localizations for the given locale as an immutable map.
-
getLocalization
default String getLocalization(String i18nName, Locale locale)
Gets the localized string for the given I18N name and locale.- Parameters:
i18nName
- to get the localization forlocale
- to get the localization for.- Returns:
- The localization for the given I18N name and locale
-
getLocalization
default String getLocalization(String i18nName, Locale locale, Locale fallbackLocale)
Gets the localized string for the given I18N name and locale.- Parameters:
i18nName
- to get the localization forlocale
- to get the localization for.fallbackLocale
- to get the localization from if the localization for the given locale is missing- Returns:
- The localization for the given I18N name and locale
-
getLocalizationObject
default TLocale getLocalizationObject(String i18nName, Locale locale)
Gets the localization object for the given I18N name and locale.- Parameters:
i18nName
- to get the localization forlocale
- to get the localization for.- Returns:
- The localization for the given I18N name and locale
-
getLocalizationObject
default TLocale getLocalizationObject(String i18nName, Locale locale, Locale fallbackLocale)
Gets the localization object for the given I18N name and locale.- Parameters:
i18nName
- to get the localization forlocale
- to get the localization for.fallbackLocale
- to get the localization from if the localization for the given locale is missing- Returns:
- The localization for the given I18N name and locale
-
-