Interface IPolyglott
- All Known Subinterfaces:
TranslatableCMSContent
- All Known Implementing Classes:
Campaign,CMSCollection,CMSCollectionTreeTab,CMSMediumTextContent,CMSPage,CMSPageTemplate,CmsRecordNoteEditBean,CMSShortTextContent,CustomSidebarWidget,FacetFieldSidebarWidget,GeoMapBean,Highlight,HtmlSidebarWidget,LicenseType,MaintenanceMode,MultiLanguageValue,PageListSidebarWidget,PersistentCMSComponent,RssFeedSidebarWidget,TermsOfUseEditBean,TranslatedText,WidgetDisplayElement
public interface IPolyglott
Interface for objects containing translations for a set of languages. Used to construct tab panels to switch between languages.
- Author:
- Florian Alpers
-
Method Summary
Modifier and TypeMethodDescriptionstatic Localestatic Localedefault Collection<Locale> Get a list of all locales configured in the faces-configuration file.static Collection<Locale> Gets a list of all locales configured in the faces-configuration file.booleanisComplete(Locale locale) If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessisEmpty(Locale)also returns true.default booleanbooleanIf this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.default booleanisSelected(Locale locale) booleanOnly meaningful for the default language for which all required fields must be filled.default voidsetSelectedLocale(String language) Convenience method.voidsetSelectedLocale(Locale locale) Sets the locale to use for display and editing.
-
Method Details
-
isComplete
If this returns true, an associated language tab should have the 'already-translated' class, otherwise the '-partly-translated' class unlessisEmpty(Locale)also returns true.- Parameters:
locale- the locale to check translation completeness for- Returns:
- true if
isValid(Locale)returns true for the given locale and all fields contain a value which have a value in the default locale. For the default locale,isComplete(Locale)andisValid(Locale)are identical. For implementations with only one field, both methods are also always identical
-
isValid
Only meaningful for the default language for which all required fields must be filled.- Parameters:
locale- the locale to validate required fields for- Returns:
- true if all required fields contain a value in the given locale
-
isEmpty
If this returns true, an associated language tab should have neither the 'already-translated' nor the '-partly-translated' class.- Parameters:
locale- the locale to check for empty fields- Returns:
- true if no fields are filled for the given locale
-
getSelectedLocale
Locale getSelectedLocale()- Returns:
- the locale currently set by
setSelectedLocale(Locale)
-
setSelectedLocale
Sets the locale to use for display and editing.- Parameters:
locale- the locale to select
-
setSelectedLocale
Convenience method. CallssetSelectedLocale(Locale)with theLocalegiven by the passed argument- Parameters:
language- IETF language tag string (e.g. "de", "en")
-
isDefaultLocaleSelected
default boolean isDefaultLocaleSelected()- Returns:
- true if the currently selected locale is also the default locale
-
isSelected
- Parameters:
locale- the locale to compare against the currently selected locale- Returns:
- return true if the currently selected locale is the given locale
-
getLocales
Get a list of all locales configured in the faces-configuration file.- Returns:
- Collection
-
getLocalesStatic
Gets a list of all locales configured in the faces-configuration file.- Returns:
- Collection
-
getDefaultLocale
- Returns:
- the default locale configured in the faces-configuration file
-
getCurrentLocale
- Returns:
- the locale set in the current faces context
-