Class AppLanguages

  • All Implemented Interfaces:
    EventListener, IGProp<GProp<?>[]>, IPropCnr, java.lang.Cloneable

    public class AppLanguages
    extends PropCnr
    The configured languages for the application.
    Author:
    Christopher Mindus
    • Constructor Detail

      • AppLanguages

        protected AppLanguages()
        Constructor without name.
    • Method Detail

      • addPredefinedProps

        protected void addPredefinedProps()
                                   throws PropException
        Adds the predefined properties for this container. This method is called once just after construction of the property container.
        Overrides:
        addPredefinedProps in class PropCnr
        Throws:
        PropException - for property exceptions.
      • getPredefinedProps

        protected void getPredefinedProps()
        Gets potential references to predefined properties for this container. This method is called once just after cloning of the property container.

        The method should get reference to using the getProp(...) methods. This allows the subclass to be able to retrieve the new instances to the properties created during addPredefinedProps() if stored in instance variables.

        Overrides:
        getPredefinedProps in class PropCnr
      • getDefaultLanguageCode

        public java.lang.String getDefaultLanguageCode()
        Gets the default language code defined when none is matching.
        Returns:
        The default language code to use (e.g. "en-US"), or null if none is defined.
      • setDefaultLanguageCode

        public boolean setDefaultLanguageCode​(java.lang.String lang)
        Sets the default language code.
        Parameters:
        lang - The language code, or null or empty String to remove default.
        Returns:
        true for changed, false for no change.
      • mapLanguage

        public AppLanguages.Result mapLanguage​(java.lang.String languageCode)
        Maps a user language code to a Result.
        Parameters:
        languageCode - The language code.
        Returns:
        The Result, never null.
      • getLanguageDefinitions

        public StringArrayProp getLanguageDefinitions()
        Gets the language map StringArrayProp that stores the language mappings as strings formatted as "lang{\t}useFor" where "lang" is the application-defined language, {\t} is the tab character and "useFor" is empty indicates the original language code being matched for, or a comma separated string of language codes with optional wildcards (* ?) that matches a particular language code to the application-defined language code.
      • getData

        public AppLanguages.Data getData()
        Gets a cached copy of (or builds) the language information from the language definitions.
        Returns:
        The AppLanguages data.