Package org.exoplatform.services.resources

Examples of org.exoplatform.services.resources.LocaleConfig


                    saveLocaleToUserProfile(prqCtx);
                }
                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

        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

        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

    }

    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

                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

                UIPortalApplication uiApp = Util.getUIPortalApplication();
                if (language == null || language.trim().length() < 1)
                    return;
                LocaleConfigService localeConfigService = event.getSource().getApplicationComponent(LocaleConfigService.class);
                LocaleConfig localeConfig = localeConfigService.getLocaleConfig(language);
                if (localeConfig == null)
                    localeConfig = localeConfigService.getDefaultLocaleConfig();
                PortalRequestContext prqCtx = Util.getPortalRequestContext();
                prqCtx.setLocale(localeConfig.getLocale());

                // GTNPORTAL-3244: A workaround to update localization in the popup messages
                ResourceBundle bundle = Util.getPortalRequestContext().getApplication().getResourceBundle(localeConfig.getLocale());
                for(AbstractApplicationMessage message : uiApp.getUIPopupMessages().getErrors()) {
                    message.setResourceBundle(bundle);
                }
                for(AbstractApplicationMessage message : uiApp.getUIPopupMessages().getWarnings()) {
                    message.setResourceBundle(bundle);
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

      String language = null;
      String country = null;
      SelectItemOption<String> option;
      while (i.hasNext())
      {
         LocaleConfig config = i.next();
         Locale locale = config.getLocale();
         displayName = locale.getDisplayName(currentLocale);
         language = locale.getLanguage();
         country = locale.getCountry();
         if (country != null && country.length() > 0)
         {
            displayLanguage = displayName + " (" + locale.getDisplayCountry(currentLocale) + ")";
            language = language + "_" + country;
         }
         else
         {
            displayLanguage = displayName;
         }
         option = new SelectItemOption<String>(displayLanguage, language, displayName);
         if (language.equals(selectedLang))
         {
            option.setSelected(true);
         }
         if (config.getLanguage().equals("en"))
         {
            lang.add(0, option);
            continue;
         }
         lang.add(option);
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.