Package jmri.util.jdom
Class LocaleSelector
- java.lang.Object
-
- jmri.util.jdom.LocaleSelector
-
public class LocaleSelector extends java.lang.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 Summary
Fields Modifier and Type Field Description (package private) static java.lang.String[]
suffixes
(package private) static boolean
testLocale
-
Constructor Summary
Constructors Constructor Description LocaleSelector()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.String
checkElement(org.jdom2.Element el, java.lang.String name, java.lang.String suffix)
Checks one element to see if it's the one for the current language else returns null.static java.lang.String
getAttribute(org.jdom2.Element el, java.lang.String name)
Return the value of an attribute for the current locale.protected static void
setSuffixes(java.lang.String[] newSuffixes)
-
-
-
Field Detail
-
suffixes
static java.lang.String[] suffixes
-
testLocale
static boolean testLocale
-
-
Constructor Detail
-
LocaleSelector
public LocaleSelector()
-
-
Method Detail
-
getAttribute
public static java.lang.String getAttribute(org.jdom2.Element el, java.lang.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 elementname
- the name of the attribute or child element- Returns:
- the value of the attribute or null
-
checkElement
static java.lang.String checkElement(org.jdom2.Element el, java.lang.String name, java.lang.String suffix)
Checks one element to see if it's the one for the current language else returns null.- Parameters:
el
- the elementname
- the attributesuffix
- the locale- Returns:
- the value of the attribute or null
-
setSuffixes
protected static void setSuffixes(java.lang.String[] newSuffixes)
-
-