Class TranslationsController.Language

Object
org.mozilla.geckoview.TranslationsController.Language
All Implemented Interfaces:
Comparable<TranslationsController.Language>
Enclosing class:
TranslationsController

public static class TranslationsController.Language extends Object implements Comparable<TranslationsController.Language>
Language display information.
  • Field Details

    • code

      @NonNull public final String code
      Language BCP 47 code.
    • localizedDisplayName

      @Nullable public final String localizedDisplayName
      Language localized display name.
  • Constructor Details

    • Language

      public Language(@NonNull String code, @Nullable String localizedDisplayName)
      Language constructor.
      Parameters:
      code - BCP 47 language code
      localizedDisplayName - how the language should be referred to in the UI.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      @AnyThread public int compareTo(@Nullable TranslationsController.Language otherLanguage)
      Comparator for sorting language objects is based on alphabetizing display language localizedDisplayName.
      Specified by:
      compareTo in interface Comparable<TranslationsController.Language>
      Parameters:
      otherLanguage - other language being compared
      Returns:
      1 if this object is earlier, 0 if equal, -1 if this object should be later for sorting
    • equals

      public boolean equals(@Nullable Object otherLanguage)
      Equality checker for language objects is based on BCP 47 code equality code.
      Overrides:
      equals in class Object
      Parameters:
      otherLanguage - other language being compared
      Returns:
      true if the BCP 47 codes match, false if they do not
    • hashCode

      public int hashCode()
      Required for overriding equals.
      Overrides:
      hashCode in class Object
      Returns:
      object hash.