SchemaLocalizations { public String schemaString(String... key) throws Exception { Assert.isTrue(key.length > 0, "There must be at least one key value"); for (SchemaLocalization schemaLocalization : this.schemaLocalizations) { Element strings = schemaLocalization.getStrings(this.languageHolder.getLang3()); for (int i = 0; i < key.length; i++) { strings = strings.getChild(key[i]); if (strings == null) { break; } } if (strings != null) { return strings.getTextNormalize(); } } return "[" + Joiner.on(',').join(key) + "]"; } SchemaLocalizations(ApplicationContext context, CurrentLanguageHolder languageHolder,
                               String schema, String extraSchemas); static SchemaLocalizations create(String schema); static SchemaLocalizations create(String schema, String lang3); String nodeLabel(GPathResult node); String nodeLabel(String qualifiedNodeName, String qualifiedParentNodeName); String nodeDesc(GPathResult node); String nodeDesc(String qualifiedNodeName, String qualifiedParentNodeName); String nodeTranslation(String qualifiedNodeName, String qualifiedParentNodeName, String type); String codelistValueLabel(GPathResult node); String codelistValueLabel(String codelist, String value); String codelistValueDesc(GPathResult node); String codelistValueDesc(String codelist, String value); String codelistTranslation(String codelist, String context, String type); String translateLanguageCode(String value); Collection<String> codelist(String codelistName); String schemaString(String... key); static final String LANG_CODELIST_NS; }
@Test public void testStrings() throws Exception { assertEquals("String One", localizations.schemaString("string1")); assertEquals("String Two Part Two", localizations.schemaString("string2", "part2")); }