use of org.javarosa.core.services.locale.TableLocaleSource in project javarosa by opendatakit.
the class TextFormTests method testPromptsWithLocalizer.
public void testPromptsWithLocalizer() {
Localizer l = new Localizer();
TableLocaleSource table = new TableLocaleSource();
l.addAvailableLocale("locale");
l.setDefaultLocale("locale");
table.setLocaleMapping("prompt;long", "loc: long text");
table.setLocaleMapping("prompt;short", "loc: short text");
table.setLocaleMapping("help", "loc: help text");
l.registerLocaleResource("locale", table);
l.setLocale("locale");
QuestionDef q = new QuestionDef();
q.setHelpTextID("help");
FormEntryPrompt fep = new DummyFormEntryPrompt(l, "prompt", q);
if (!"loc: long text".equals(fep.getLongText())) {
fail("Long text did not localize properly");
}
if (!"loc: short text".equals(fep.getShortText())) {
fail("Short text did not localize properly");
}
}
Aggregations