Package jmri.util.jdom
Class LocaleSelector
java.lang.Object
jmri.util.jdom.LocaleSelector
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
FieldsModifier and TypeFieldDescription(package private) static String[](package private) static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringcheckElement(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.static StringgetAttribute(org.jdom2.Element el, String name) Return the value of an attribute for the current locale.protected static voidsetSuffixes(String[] newSuffixes)
-
Field Details
-
suffixes
-
testLocale
-
-
Constructor Details
-
LocaleSelector
public LocaleSelector()
-
-
Method Details
-
getAttribute
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
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
-