@Override public Map<String, String> getTranslationsForLocale(String locale) { ICUBasedLocalizationService icuBasedLocalizationService = (ICUBasedLocalizationService) localizationService; Map<String, String> translations = new HashMap<String, String>(); List<ULocale> localeIterator = icuBasedLocalizationService.getParentLocale(new ULocale(locale)); for (Key key : keyRepository.loadAll()) { Translation translation = icuBasedLocalizationService.getTranslationWithFallBack(key, localeIterator); if (translation != null) { translations.put(key.getEntityId(), translation.getValue()); } } return translations; } }
@Override protected void doAssembleDtoFromAggregate(KeyDTO targetDto, Key sourceEntity) { targetDto.setName(sourceEntity.getEntityId()); targetDto.setComment(sourceEntity.getComment()); targetDto.setOutdated(sourceEntity.isOutdated()); for (Translation tln : sourceEntity.getTranslations().values()) { targetDto.addTranslationDTO(tln.getEntityId().getLocale(), tln.getValue(), tln.isOutdated(), tln.isApproximate()); } }