Package org.exoplatform.services.resources

Examples of org.exoplatform.services.resources.LocaleConfigService


            return o1.getLabel().compareToIgnoreCase(o2.getLabel());
        }
    }

    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();
View Full Code Here


        this.firstTime = firstTime;
    }

    private void initLanguageSelectBox(UIFormSelectBox langSelectBox) {
        List<SelectItemOption<String>> lang = new ArrayList<SelectItemOption<String>>();
        LocaleConfigService localeService = getApplicationComponent(LocaleConfigService.class);
        Locale currentLocale = WebuiRequestContext.getCurrentInstance().getLocale();
        Iterator<LocaleConfig> i = localeService.getLocalConfigs().iterator();
        String displayName = null;
        String language = null;
        String country = null;
        String defaultValue = null;
        SelectItemOption<String> option;
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();
        }
View Full Code Here

            return o1.getLabel().compareToIgnoreCase(o2.getLabel());
        }
    }

    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();
View Full Code Here

        // throw new Exception("Can't load user portal config");

        // dang.tung - set portal language by user preference -> browser ->
        // default
        // ------------------------------------------------------------------------------
        LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);

        Locale locale = context.getLocale();
        if (locale == null) {
            if (log.isWarnEnabled())
                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);
View Full Code Here

                String language = userProfile.getAttribute(Constants.USER_LANGUAGE);

                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());
View Full Code Here

        invokeGetBindingBean(pageNode_);
    }

    private void initLanguageSelectBox(UIFormSelectBox langSelectBox) {
        List<SelectItemOption<String>> lang = new ArrayList<SelectItemOption<String>>();
        LocaleConfigService localeService = getApplicationComponent(LocaleConfigService.class);
        Locale currentLocale = ((PortletRequestContext) WebuiRequestContext.getCurrentInstance()).getLocale();
        Iterator<LocaleConfig> i = localeService.getLocalConfigs().iterator();
        String displayName = null;
        String language = null;
        String country = null;
        String defaultValue = null;
        SelectItemOption<String> option;
View Full Code Here

      String selectedLang = langSelectBox.getSelectedValues()[0];

      List<SelectItemOption<String>> lang = new ArrayList<SelectItemOption<String>>();
      langSelectBox.setOptions(lang); // Clear

      LocaleConfigService localeService = getApplicationComponent(LocaleConfigService.class);
      Locale currentLocale = ((PortletRequestContext)WebuiRequestContext.getCurrentInstance()).getLocale();
      Iterator<LocaleConfig> i = localeService.getLocalConfigs().iterator();
      String displayLanguage = null;
      String displayName = null;
      String language = null;
      String country = null;
      SelectItemOption<String> option;
View Full Code Here

      }
      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 = uiPortalApp.getLocale().getLanguage();
View Full Code Here

     
      // dang.tung - set portal language by user preference -> browser ->
      // 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());
      // -------------------------------------------------------------------------------
View Full Code Here

TOP

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

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.