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 SummaryFields Modifier and Type Field Description (package private) static java.lang.String[]suffixes(package private) static booleantestLocale
 - 
Constructor SummaryConstructors Constructor Description LocaleSelector()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.StringcheckElement(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.StringgetAttribute(org.jdom2.Element el, java.lang.String name)Return the value of an attribute for the current locale.protected static voidsetSuffixes(java.lang.String[] newSuffixes)
 
- 
- 
- 
Field Detail- 
suffixesstatic java.lang.String[] suffixes 
 - 
testLocalestatic boolean testLocale 
 
- 
 - 
Constructor Detail- 
LocaleSelectorpublic LocaleSelector() 
 
- 
 - 
Method Detail- 
getAttributepublic 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 element
- name- the name of the attribute or child element
- Returns:
- the value of the attribute or null
 
 - 
checkElementstatic 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 element
- name- the attribute
- suffix- the locale
- Returns:
- the value of the attribute or null
 
 - 
setSuffixesprotected static void setSuffixes(java.lang.String[] newSuffixes) 
 
- 
 
-