Package org.exoplatform.services.resources

Examples of org.exoplatform.services.resources.LocaleConfig


        String displayName = null;
        String language = null;
        String country = 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


      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();
      OrganizationService orgService = getApplicationComponent(OrganizationService.class);
      UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
      String userLanguage = userProfile.getUserInfoMap().get("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))
         {
            uiPortalApp.setLocale(localeConfig.getLocale());
            //editPortal.refreshNavigation(localeConfig.getLocale());
            uiPortalApp.localizeNavigations();
         }
         uiPortalApp.setSkin(editPortal.getSkin());
      }
View Full Code Here

      SelectItemOption localeItem = null;
      List<SelectItemOption> optionsList = new ArrayList<SelectItemOption>();

      for (Object object : configService.getLocalConfigs())
      {
         LocaleConfig localeConfig = (LocaleConfig)object;
         Locale locale = localeConfig.getLocale();
         String displayName = capitalizeFirstLetter(locale.getDisplayLanguage(currentLocale));
         String lang = locale.getLanguage();
         String country = locale.getCountry();
         String localedName = capitalizeFirstLetter(locale.getDisplayLanguage(locale));;
View Full Code Here

         Util.getPortalRequestContext().setFullRender(false);
         if (language == null || language.trim().length() < 1)
            return;
         // if(!uiPortal.isModifiable()) return;
         LocaleConfigService localeConfigService = event.getSource().getApplicationComponent(LocaleConfigService.class);
         LocaleConfig localeConfig = localeConfigService.getLocaleConfig(language);
         if (localeConfig == null)
            localeConfig = localeConfigService.getDefaultLocaleConfig();
         uiApp.setLocale(localeConfig.getLocale());
         uiApp.setOrientation(localeConfig.getOrientation());
         uiApp.localizeNavigations();
         OrganizationService orgService = event.getSource().getApplicationComponent(OrganizationService.class);
         String remoteUser = event.getRequestContext().getRemoteUser();
         if (remoteUser != null)
         {
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());
      this.<UIFormInputSet> getChildById("PortalSetting").<UIFormSelectBox> getChildById(FIELD_LOCALE).setValue(
         localeConfig.getLanguage());
      setActions(new String[]{"Save", "Close"});
   }
View Full Code Here

   private void createDefaultItem() throws Exception
   {
      UIPortal uiPortal = Util.getUIPortal();
      LocaleConfigService localeConfigService = getApplicationComponent(LocaleConfigService.class);
      Collection<?> listLocaleConfig = localeConfigService.getLocalConfigs();
      LocaleConfig defaultLocale = localeConfigService.getDefaultLocaleConfig();
      String defaultLanguage = defaultLocale.getLanguage();
      Locale currentLocate = Util.getPortalRequestContext().getLocale();
      Iterator<?> iterator = listLocaleConfig.iterator();
      while (iterator.hasNext())
      {
         LocaleConfig localeConfig = (LocaleConfig)iterator.next();
         SelectItemOption<String> option =
            new SelectItemOption<String>(localeConfig.getLocale().getDisplayName(currentLocate), localeConfig
               .getLanguage());
         if (defaultLanguage.equals(localeConfig.getLanguage()))
         {
            option.setSelected(true);
         }
         languages.add(option);
      }
View Full Code Here

      }
   }

   public void refreshNavigation(Locale locale)
   {
      LocaleConfig localeConfig =
         getApplicationComponent(LocaleConfigService.class).getLocaleConfig(locale.getLanguage());
      for (PageNavigation nav : navigations)
      {
         if (nav.getOwnerType().equals(PortalConfig.USER_TYPE))
         {
            continue;
         }
         String ownerId = nav.getOwnerId();
         if (nav.getOwnerType().equals(PortalConfig.GROUP_TYPE))
         {
            // Remove the trailing '/' for a group
            ownerId = ownerId.substring(1);
         }
         ResourceBundle res = localeConfig.getNavigationResourceBundle(nav.getOwnerType(), ownerId);
         for (PageNode node : nav.getNodes())
         {
            resolveLabel(res, node);
         }
      }
View Full Code Here

      // 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();
      if (user != null)
      {
         UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(user);
         if (userProfile != null)
         {
            portalLanguage = userProfile.getUserInfoMap().get("user.language");
         }
         else
         {
            if (log.isWarnEnabled())
               log.warn("Could not load user profile for " + user + ". Using default portal locale.");
         }
      }
      localeConfig = localeConfigService.getLocaleConfig(portalLanguage);
      if (portalLanguage == null || !portalLanguage.equals(localeConfig.getLanguage()))
      {
         // 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);
     
View Full Code Here

        String displayName = null;
        String language = null;
        String country = 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 defaultLang =
            // localeService_.getDefaultLocaleConfig().getLanguage();
            Locale defaultLocale = localeService_.getDefaultLocaleConfig().getLocale();

            for (Iterator<LocaleConfig> iter = localeConfigs.iterator(); iter.hasNext();) {
                LocaleConfig localeConfig = iter.next();
                // String language = localeConfig.getLanguage();
                // String content = getResourceBundleContent(name, language,
                // defaultLang, cl);
                Locale locale = localeConfig.getLocale();
                String language = locale.getLanguage();
                String country = locale.getCountry();
                String variant = locale.getVariant();

                String content = getResourceBundleContent(name, locale, defaultLocale, cl);
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.