*/
public LocalizationViewBean buildViewBeanLocalization(final RequestData requestData, final Localization localization) throws Exception {
final Locale locale = requestData.getLocale();
final String localizationCodeNavigation = localization.getCode();
final LocalizationViewBean localizationViewBean = new LocalizationViewBean();
localizationViewBean.setCode(localizationCodeNavigation);
localizationViewBean.setDescription(localization.getDescription());
localizationViewBean.setCountry(localization.getCountry());
localizationViewBean.setLanguage(localization.getLanguage());
localizationViewBean.setName(localization.getName());
String localizationCodeTranslation = localizationCodeNavigation;
if(localizationCodeTranslation.contains("-")){
String[] split = localizationCodeTranslation.split("-");
localizationCodeTranslation = split[0] + "-" + split[1].toUpperCase();
localizationViewBean.setName(getReferenceData(ScopeReferenceDataMessage.LANGUAGE, localizationCodeTranslation, locale));
} else {
localizationViewBean.setName(getReferenceData(ScopeReferenceDataMessage.LANGUAGE, localizationCodeTranslation.toLowerCase(), locale));
}
if (localization.getLocale().equals(locale)) {
localizationViewBean.setActive(true);
}
DateFormat dateFormat = requestUtil.getFormatDate(requestData, DateFormat.MEDIUM, DateFormat.MEDIUM);
if (localization.getDateCreate() != null) {
localizationViewBean.setDateCreate(dateFormat.format(localization.getDateCreate()));
}
if (localization.getDateUpdate() != null) {
localizationViewBean.setDateUpdate(dateFormat.format(localization.getDateUpdate()));
}
RequestData requestDataChangecontext = new RequestData();
BeanUtils.copyProperties(requestData, requestDataChangecontext);
requestDataChangecontext.setMarketAreaLocalization(localization);
localizationViewBean.setChangeContextUrl(urlService.buildChangeLanguageUrl(requestDataChangecontext));
localizationViewBean.setChangeBackofficeLanguageUrl(urlService.buildChangeBackofficeLanguageUrl(requestDataChangecontext, localization));
localizationViewBean.setHomeUrl(urlService.generateUrl(FoUrls.HOME, requestDataChangecontext));
return localizationViewBean;
}