* for the language, the default (English) numberer is used.
*/
public static Numberer makeNumberer(String language, String country, XPathContext context) {
Numberer numberer;
if ("en".equals(language)) {
numberer = defaultNumberer;
} else {
String langClassName = "org.orbeon.saxon.number.Numberer_";
for (int i = 0; i < language.length(); i++) {
if (Character.isLetter(language.charAt(i))) {
langClassName += language.charAt(i);
}
}
try {
if (context == null) {
Object x = Class.forName(langClassName).newInstance();
numberer = (Numberer)x ;
} else {
numberer = (Numberer) (context.getConfiguration().getInstance(langClassName, null));
}
} catch (XPathException err) {
numberer = defaultNumberer;
} catch (ClassNotFoundException err) {
numberer = defaultNumberer;
} catch (InstantiationException err) {
numberer = defaultNumberer;
} catch (IllegalAccessException err) {
numberer = defaultNumberer;
}
}
numberer.setCountry(country);
return numberer;
}