Interface LanguageType

All Superinterfaces:
net.okapia.osid.torrefacto.collect.TypeEnum
All Known Implementing Classes:
EnglishRegionTypes, ISOAncientLanguageTypes, ISOConstructedLanguageTypes, ISOExtinctLanguageTypes, ISOMajorLanguageTypes, USEnglishDialectTypes

public interface LanguageType extends net.okapia.osid.torrefacto.collect.TypeEnum
A marker for the language type enumerations, common to ISOMajorLanguageTypes (ISO 639-2), the ISO 639-3 ISOAncientLanguageTypes, ISOExtinctLanguageTypes, and ISOConstructedLanguageTypes, and the regional subtypes such as EnglishRegionTypes (which qualify a language with a region, e.g. ENG/US). It lets a single argument accept a language drawn from any of those enumerations while excluding script and format types.

It also answers a language's ISO codes, so a caller bridging to a platform that speaks ISO 639 — java.util.Locale, CLDR, a BCP-47 tag — need not read them out of a Type's identifier. Each is optional: ISO 639-1 names only a few hundred languages, and a regional subtype is named by no ISO 639 code at all, answering instead the codes of the language it qualifies.

The three-letter codes come in two sets. ISO 639-2 gives twenty languages a distinct bibliographic code, used in library cataloguing, alongside the terminological one; for every other language the two are the same. The terminological set is what ISO 639-3, java.util.Locale, and BCP-47 use, and it is what these enumerations name their constants for, so getISO3 is the code to reach for unless bibliographic data is what you are handling.

  • Method Summary

    Modifier and Type
    Method
    Description
    default Optional<String>
    Gets the ISO 639-1 two-letter code for this language.
    getISO2(Type type)
    Gets the ISO 639-1 two-letter code for a language Type.
    default Optional<String>
    Gets the ISO 639 terminological three-letter code for this language.
    getISO3(Type type)
    Gets the ISO 639 terminological three-letter code for a language Type.
    default Optional<String>
    Gets the ISO 639-2 bibliographic three-letter code for this language, which differs from the terminological code for twenty languages and is the same code for every other.
    Gets the ISO 639-2 bibliographic three-letter code for a language Type.

    Methods inherited from interface net.okapia.osid.torrefacto.collect.TypeEnum

    getType
  • Method Details

    • getISO2

      default Optional<String> getISO2()
      Gets the ISO 639-1 two-letter code for this language.
      Returns:
      the two-letter code, empty if this language has none
    • getISO3

      default Optional<String> getISO3()
      Gets the ISO 639 terminological three-letter code for this language.
      Returns:
      the three-letter code, empty if this language has none
    • getISOBibliographicCode

      default Optional<String> getISOBibliographicCode()
      Gets the ISO 639-2 bibliographic three-letter code for this language, which differs from the terminological code for twenty languages and is the same code for every other.
      Returns:
      the bibliographic code, empty if this language has none
    • getISO2

      static Optional<String> getISO2(Type type)
      Gets the ISO 639-1 two-letter code for a language Type.
      Parameters:
      type - a language type
      Returns:
      the two-letter code, empty if the Type names no language these enumerations know, or one with no such code
      Throws:
      NullArgumentException - type is null
    • getISO3

      static Optional<String> getISO3(Type type)
      Gets the ISO 639 terminological three-letter code for a language Type.
      Parameters:
      type - a language type
      Returns:
      the three-letter code, empty if the Type names no language these enumerations know, or one with no such code
      Throws:
      NullArgumentException - type is null
    • getISOBibliographicCode

      static Optional<String> getISOBibliographicCode(Type type)
      Gets the ISO 639-2 bibliographic three-letter code for a language Type.
      Parameters:
      type - a language type
      Returns:
      the bibliographic code, empty if the Type names no language these enumerations know, or one with no such code
      Throws:
      NullArgumentException - type is null