Class LocaleSelector

java.lang.Object
jmri.util.jdom.LocaleSelector

public class LocaleSelector extends Object
Select XML content based on current Locale. Tries locale and country separated by an underscore, language, and then uses the default Locale. _tlh is treated as a special case, for the ant locale target
Since:
2.9.3
  • Field Details

  • Constructor Details

  • Method Details

    • getAttribute

      public static String getAttribute(org.jdom2.Element el, String name)
      Return the value of an attribute for the current locale.

      <foo temp="a"> <temp xml:lang="hh">b</temp> </foo>

      Say it's looking for the attribute ATT. For each possible suffix, it first looks for a contained element named ATT with an XML 'lang' attribute for the suffix. If so, it takes that value. If none are found, the attribute value is taken from the original element.

      Parameters:
      el - the element with the attribute or child element
      name - the name of the attribute or child element
      Returns:
      the value of the attribute or null
    • checkElement

      static String checkElement(org.jdom2.Element el, String name, String suffix)
      Checks one element to see if it's the one for the current language else returns null.
      Parameters:
      el - the element
      name - the attribute
      suffix - the locale
      Returns:
      the value of the attribute or null
    • setSuffixes

      protected static void setSuffixes(String[] newSuffixes)