use of org.crosswire.jsword.internationalisation.LocaleProvider in project step by STEPBible.
the class StepServletConfig method configureJSword.
/**
* Configure JSword.
*/
private void configureJSword() {
BookName.setFullBookName(false);
final Provider<ClientSession> provider = this.injector.getProvider(ClientSession.class);
ConfigEntry.setConfigValueInterceptor(this.injector.getInstance(ConfigValueInterceptor.class));
// set the locale resolution
LocaleProviderManager.setLocaleProvider(new LocaleProvider() {
@Override
public Locale getUserLocale() {
try {
return provider.get().getLocale();
} catch (final ProvisionException ex) {
return Locale.ENGLISH;
}
}
});
if (Boolean.TRUE.equals(Boolean.getBoolean("step.development"))) {
TransformingSAXEventProvider.setDevelopmentMode(true);
}
}
use of org.crosswire.jsword.internationalisation.LocaleProvider in project step by STEPBible.
the class XmlToOSIS method applyXslt.
private void applyXslt(final Document input, File output) throws Exception {
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(getClass().getResourceAsStream(String.format("/transform-%s.xsl", this.conversionType))));
final DOMResult outputTarget = new DOMResult();
transformer.setParameter("identifier", this.moduleName);
transformer.setParameter("versification", this.versification);
LocaleProviderManager.setLocaleProvider(new LocaleProvider() {
@Override
public Locale getUserLocale() {
return new Locale(XmlToOSIS.this.languageCode);
}
});
transformer.transform(new DOMSource(input), outputTarget);
Document n = (Document) outputTarget.getNode();
moveNodes(n);
Transformer fileTransformer = tFactory.newTransformer();
fileTransformer.transform(new DOMSource(n), new StreamResult(new FileOutputStream(output)));
}
Aggregations