Class LanguageOption

    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • languageNames

        private static final java.util.Map<java.lang.String,​java.lang.String> languageNames
        Extra languages with alternate names.
      • languages

        private static final java.util.List<LanguageOption.Language> languages
        A list of know languages. Initialized on demand with initializeLanguages(), as it depends on the location of the i18n directory having stabilized.
    • Constructor Detail

      • LanguageOption

        public LanguageOption​(Specification specification)
        Creates a new LanguageOption.
        Parameters:
        specification - The Specification to refer to.
    • Method Detail

      • initializeLanguages

        private static void initializeLanguages()
        Initialize the languages list.
      • getLanguage

        private LanguageOption.Language getLanguage​(java.lang.String key)
        Find the language with the given key.
        Parameters:
        key - The key to search for.
        Returns:
        The corresponding language, or null if none found.
      • getChoices

        public java.util.List<LanguageOption.Language> getChoices()
        Gets a list of the available languages.
        Returns:
        A list of the available languages.
      • setValue

        protected void setValue​(java.lang.String valueString,
                                java.lang.String defaultValueString)
        Sets the value of this option from the given string representation. Both parameters must not be null at the same time. This method does nothing. Override it if the option has a suitable string representation.
        Overrides:
        setValue in class AbstractOption<LanguageOption.Language>
        Parameters:
        valueString - The string representation of the value of this Option.
        defaultValueString - The string representation of the default value of this Option.
      • writeAttributes

        protected void writeAttributes​(FreeColXMLWriter xw)
                                throws javax.xml.stream.XMLStreamException
        Write the attributes of this object to a stream. To be overridden if required by any object that has attributes and uses the toXML(FreeColXMLWriter, String) call.
        Overrides:
        writeAttributes in class AbstractOption<LanguageOption.Language>
        Parameters:
        xw - The FreeColXMLWriter to write to.
        Throws:
        javax.xml.stream.XMLStreamException - if there are any problems writing to the stream.
      • getXMLTagName

        public java.lang.String getXMLTagName()
        Get the serialization tag for this object.
        Specified by:
        getXMLTagName in class FreeColObject
        Returns:
        The tag.