use of org.obiba.core.translator.PrefixedValueTranslator in project mica2 by obiba.
the class EntityConfigTranslator method translateSchemaForm.
/**
* Translates both schema and definition JSON strings defined in the entity configuration.
*
* @param locale
* @param entityConfig
* @param <T>
*/
public <T extends EntityConfig> void translateSchemaForm(String locale, T entityConfig) {
if (StringUtils.isEmpty(locale))
return;
Translator translator = JsonTranslator.buildSafeTranslator(() -> micaConfigService.getTranslations(locale, false));
translator = new PrefixedValueTranslator(translator);
TranslationUtils translationUtils = new TranslationUtils();
entityConfig.setSchema(translationUtils.translate(entityConfig.getSchema(), translator));
entityConfig.setDefinition(translationUtils.translate(entityConfig.getDefinition(), translator));
}
use of org.obiba.core.translator.PrefixedValueTranslator in project mica2 by obiba.
the class EntityConfigKeyTranslationService method translateSchemaForm.
private void translateSchemaForm(Translator translator, EntityConfig config) {
TranslationUtils translationUtils = new TranslationUtils();
PrefixedValueTranslator prefixedValueTranslator = new PrefixedValueTranslator(translator);
config.setSchema(translationUtils.translate(config.getSchema(), prefixedValueTranslator));
config.setDefinition(translationUtils.translate(config.getDefinition(), prefixedValueTranslator));
}
Aggregations