// default
// ------------------------------------------------------------------------------
String portalLanguage = null;
LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
OrganizationService orgService = getApplicationComponent(OrganizationService.class);
LocaleConfig localeConfig = localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
String user = context.getRemoteUser();
String portalSkin = null;
if (user != null)
{
UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(user);
if (userProfile != null)
{
portalLanguage = userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE);
portalSkin = userProfile.getUserInfoMap().get(Constants.USER_SKIN);
}
else
{
if (log.isWarnEnabled())
log.warn("Could not load user profile for " + user + ". Using default portal locale.");
}
}
localeConfig = localeConfigService.getLocaleConfig(portalLanguage);
String localeLanguage = (localeConfig.getLocale().getCountry().length() > 0) ? localeConfig.getLocale()
.getLanguage()
+ "_" + localeConfig.getLocale().getCountry() : localeConfig.getLocale().getLanguage();
if (portalLanguage == null || !portalLanguage.equals(localeLanguage))
{
// if user language no support by portal -> get browser language if no
// ->
// get portal
portalLanguage = context.getRequest().getLocale().getLanguage();
localeConfig = localeConfigService.getLocaleConfig(portalLanguage);
if (!portalLanguage.equals(localeConfig.getLanguage()))
{
localeConfig = localeConfigService.getLocaleConfig(userPortalConfig_.getPortalConfig().getLocale());
}
}
setLocale(localeConfig.getLocale());
setOrientation(localeConfig.getOrientation());
// -------------------------------------------------------------------------------
context.setUIApplication(this);
this.all_UIPortals = new HashMap<UIPortalKey, UIPortal>(5);