Package org.exoplatform.services.resources

Examples of org.exoplatform.services.resources.LocaleConfig


                return;
            }
            // if(!uiPortal.isModifiable()) return;

            LocaleConfigService localeConfigService = event.getSource().getApplicationComponent(LocaleConfigService.class);
            LocaleConfig localeConfig = localeConfigService.getLocaleConfig(language);
            if (localeConfig == null)
                localeConfig = localeConfigService.getDefaultLocaleConfig();
            prqCtx.setLocale(localeConfig.getLocale());

            if (prqCtx.getRequestLocale() != null) {
                NodeURL url = prqCtx.createURL(NodeURL.TYPE).setNode(Util.getUIPortal().getNavPath());
                url.setLocale(prqCtx.getLocale());
                prqCtx.sendRedirect(url.toString());
View Full Code Here


        invokeGetBindingBean(editPortal);
        ((UIFormStringInput) getChild(UIFormInputSet.class).getChildById(FIELD_NAME)).setValue(getPortalOwner());

        LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(editPortal.getLocale());
        String lang = localeConfig.getLanguage();
        if (localeConfig.getLocale().getCountry() != null && localeConfig.getLocale().getCountry().length() > 0) {
            lang += "_" + localeConfig.getLocale().getCountry();
        }

        this.<UIFormInputSet> getChildById("PortalSetting").<UIFormSelectBox> getChildById(FIELD_LOCALE).setValue(lang);
        setActions(new String[] { "Save", "Close" });
    }
View Full Code Here

    }

    private void createDefaultItem() throws Exception {
        LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
        Collection<?> listLocaleConfig = localeConfigService.getLocalConfigs();
        LocaleConfig defaultLocale = localeConfigService.getDefaultLocaleConfig();
        String defaultLanguage = defaultLocale.getLanguage();
        Locale currentLocale = Util.getPortalRequestContext().getLocale();
        Iterator<?> iterator = listLocaleConfig.iterator();
        while (iterator.hasNext()) {
            LocaleConfig localeConfig = (LocaleConfig) iterator.next();
            ResourceBundle localeResourceBundle = getResourceBundle(currentLocale);
            Locale local = localeConfig.getLocale();
            String lang = local.getLanguage();
            if (local.getCountry() != null && local.getCountry().length() > 0) {
                lang += "_" + local.getCountry();
            }
View Full Code Here

            editPortal.setModifiable(acl.hasEditPermission(pConfig));
        } else {
            editPortal.setModifiable(false);
        }
        LocaleConfigService localeConfigService = uiPortalApp.getApplicationComponent(LocaleConfigService.class);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(portalConfig.getLocale());
        if (localeConfig == null) {
            localeConfig = localeConfigService.getDefaultLocaleConfig();
        }
        // TODO dang.tung - change layout when portal get language from UIPortal
        // (user and browser not support)
        // ----------------------------------------------------------------------------------------------------
        String portalAppLanguage = prContext.getLocale().getLanguage();
        OrganizationService orgService = getApplicationComponent(OrganizationService.class);
        UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
        String userLanguage = userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE);
        String browserLanguage = prContext.getRequest().getLocale().getLanguage();

        // in case: edit current portal, set skin and language for uiPortalApp
        if (uiPortal == null) {
            if (!portalAppLanguage.equals(userLanguage) && !portalAppLanguage.equals(browserLanguage)) {
                prContext.setLocale(localeConfig.getLocale());
                // editPortal.refreshNavigation(localeConfig.getLocale());
                // uiPortalApp.localizeNavigations();
            }
            uiPortalApp.setSkin(editPortal.getSkin());
        }
View Full Code Here

        String language = null;
        String country = null;
        String defaultValue = null;
        SelectItemOption<String> option;
        while (i.hasNext()) {
            LocaleConfig config = i.next();
            Locale locale = config.getLocale();

            language = locale.getLanguage();
            country = locale.getCountry();
            if (country != null && country.length() > 0) {
                language = language + "_" + country;
View Full Code Here

        invokeGetBindingBean(editPortal);
        ((UIFormStringInput) getChild(UIFormInputSet.class).getChildById(FIELD_NAME)).setValue(getPortalOwner());

        LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(editPortal.getLocale());
        String lang = localeConfig.getLanguage();
        if (localeConfig.getLocale().getCountry() != null && localeConfig.getLocale().getCountry().length() > 0) {
            lang += "_" + localeConfig.getLocale().getCountry();
        }

        this.<UIFormInputSet> getChildById("PortalSetting").<UIFormSelectBox> getChildById(FIELD_LOCALE).setValue(lang);
        setActions(new String[] { "Save", "Close" });
    }
View Full Code Here

    }

    private void createDefaultItem() throws Exception {
        LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
        Collection<?> listLocaleConfig = localeConfigService.getLocalConfigs();
        LocaleConfig defaultLocale = localeConfigService.getDefaultLocaleConfig();
        String defaultLanguage = defaultLocale.getLanguage();
        Locale currentLocale = Util.getPortalRequestContext().getLocale();
        Iterator<?> iterator = listLocaleConfig.iterator();
        while (iterator.hasNext()) {
            LocaleConfig localeConfig = (LocaleConfig) iterator.next();
            ResourceBundle localeResourceBundle = getResourceBundle(currentLocale);
            Locale local = localeConfig.getLocale();
            String lang = local.getLanguage();
            if (local.getCountry() != null && local.getCountry().length() > 0) {
                lang += "_" + local.getCountry();
            }
View Full Code Here

    private void resetOrientation(PortalRequestContext context, Locale loc) {
        ExoContainer container = context.getApplication().getApplicationServiceContainer();
        LocaleConfigService localeConfigService = (LocaleConfigService) container
                .getComponentInstanceOfType(LocaleConfigService.class);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(LocaleContextInfo.getLocaleAsString(loc));
        if (localeConfig == null) {
            if (log.isWarnEnabled())
                log.warn("Locale changed to unsupported Locale during request processing: " + loc);
            return;
        }
        // we presume PortalRequestContext, and UIPortalApplication
        ((UIPortalApplication) context.getUIApplication()).setOrientation(localeConfig.getOrientation());
    }
View Full Code Here

                prContext.getUserPortalConfig().setPortalConfig(pConfig);
            } else {
                editPortal.setModifiable(false);
            }
            LocaleConfigService localeConfigService = uiPortalApp.getApplicationComponent(LocaleConfigService.class);
            LocaleConfig localeConfig = localeConfigService.getLocaleConfig(portalConfig.getLocale());
            if (localeConfig == null) {
                localeConfig = localeConfigService.getDefaultLocaleConfig();
            }
            // TODO dang.tung - change layout when portal get language from UIPortal
            // (user and browser not support)
            // ----------------------------------------------------------------------------------------------------
            String portalAppLanguage = prContext.getLocale().getLanguage();
            OrganizationService orgService = getApplicationComponent(OrganizationService.class);
            UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
            String userLanguage = userProfile != null ? userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE) : null;
            String browserLanguage = prContext.getRequest().getLocale().getLanguage();

            // in case: edit current portal, set skin and language for uiPortalApp
            if (uiPortal == null) {
                if (!portalAppLanguage.equals(userLanguage) && !portalAppLanguage.equals(browserLanguage)) {
                    prContext.setLocale(localeConfig.getLocale());
                }
                uiPortalApp.setSkin(editPortal.getSkin());
            }
            prContext.refreshResourceBundle();
View Full Code Here

                log.warn("No locale set on PortalRequestContext! Falling back to 'en'.");
            locale = Locale.ENGLISH;
        }

        String localeName = LocaleContextInfo.getLocaleAsString(locale);
        LocaleConfig localeConfig = localeConfigService.getLocaleConfig(localeName);
        if (localeConfig == null) {
            if (log.isWarnEnabled())
                log.warn("Unsupported locale set on PortalRequestContext: " + localeName + "! Falling back to 'en'.");
            localeConfig = localeConfigService.getLocaleConfig(Locale.ENGLISH.getLanguage());
        }
        setOrientation(localeConfig.getOrientation());

        // -------------------------------------------------------------------------------
        context.setUIApplication(this);

        this.all_UIPortals = new HashMap<SiteKey, UIPortal>(5);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.resources.LocaleConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.