Package org.exoplatform.services.resources

Examples of org.exoplatform.services.resources.LocaleConfigService


        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 displayName = null;
        String language = null;
        String country = null;
        SelectItemOption<String> option;
        while (i.hasNext()) {
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

        if (pConfig != null) {
            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();
View Full Code Here

            throw new IllegalArgumentException("Expected PortalRequestContext, but got: " + context);

        PortalRequestContext reqCtx = (PortalRequestContext) context;
        ExoContainer container = app.getApplicationServiceContainer();

        LocaleConfigService localeConfigService = (LocaleConfigService) container
                .getComponentInstanceOfType(LocaleConfigService.class);
        LocalePolicy localePolicy = (LocalePolicy) container.getComponentInstanceOfType(LocalePolicy.class);

        LocaleContextInfo localeCtx = new LocaleContextInfo();

        Set<Locale> supportedLocales = new HashSet<Locale>();
        for (LocaleConfig lc : localeConfigService.getLocalConfigs()) {
            supportedLocales.add(lc.getLocale());
        }
        localeCtx.setSupportedLocales(supportedLocales);

        HttpServletRequest request = HttpServletRequest.class.cast(context.getRequest());
View Full Code Here

        saveSessionLocale(context, loc);
    }

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

                // Nothing we can do, move on
                chain.doFilter(req, res);
                return;
            }

            LocaleConfigService localeConfigService = (LocaleConfigService) container
                    .getComponentInstanceOfType(LocaleConfigService.class);
            LocalePolicy localePolicy = (LocalePolicy) container.getComponentInstanceOfType(LocalePolicy.class);

            LocaleContextInfo localeCtx = new LocaleContextInfo();

            Set<Locale> supportedLocales = new HashSet();
            for (LocaleConfig lc : localeConfigService.getLocalConfigs()) {
                supportedLocales.add(lc.getLocale());
            }
            localeCtx.setSupportedLocales(supportedLocales);

            localeCtx.setBrowserLocales(Collections.list(request.getLocales()));
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

    private String name_;

    @SuppressWarnings("unchecked")
    public UILanguageSelector() throws Exception {
        name_ = "UIChangeLanguage";
        LocaleConfigService configService = getApplicationComponent(LocaleConfigService.class);
        Locale currentLocale = Util.getPortalRequestContext().getLocale();
        SelectItemOption localeItem = null;
        List<SelectItemOption> optionsList = new ArrayList<SelectItemOption>();

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

                if (prqCtx.getRemoteUser() != null) {
                    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());
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

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.