Examples of JahiaResourceBundle


Examples of org.jahia.utils.i18n.JahiaResourceBundle

    public static String getMessage(String key) {
        return JahiaResourceBundle.getJahiaInternalResource(key, Jahia.getThreadParamBean().getUILocale());
    }

    public LocalizationContext getLocalizationContext() {
        return new LocalizationContext(new JahiaResourceBundle(JahiaResourceBundle.JAHIA_INTERNAL_RESOURCES,Jahia.getThreadParamBean().getUILocale()));
    }
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

            logger.debug("Resources key: " + key);
        }
        if (key == null || key.length() == 0) {
            return key;
        }
        String value = new JahiaResourceBundle(locale, site != null ? site.getTemplatePackageName() : null).get(key, null);
        if (value == null || value.length() == 0) {
            value = JahiaResourceBundle.getJahiaInternalResource(key, locale);
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Resources value: " + value);
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

        this.getLocale();
        resolveUILocale();
        Config.set(request, Config.FMT_LOCALE, getUILocale());
        // init localization context
        Config.set(request, Config.FMT_LOCALIZATION_CONTEXT,
                new LocalizationContext(new JahiaResourceBundle(getUILocale(), getSite()
                        .getTemplatePackageName()), getUILocale()));           
    }
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

                        request.getSession().setAttribute(ProcessingContext.SESSION_UI_LOCALE, uiLocale);
                        user.setProperty("preferredLanguage", uiLocale.toString());
                    }

                    Config.set(request, Config.FMT_LOCALIZATION_CONTEXT,
                            new LocalizationContext(new JahiaResourceBundle(uiLocale, site.getTemplatePackageName()), uiLocale));

                    AdministrationModulesRegistry modulesRegistry = (AdministrationModulesRegistry) SpringContextSingleton.getInstance().getContext().getBean("administrationModulesRegistry");
                    AdministrationModule currentModule = modulesRegistry.getServerAdministrationModule(operation);
                    if (currentModule != null) {
                        if (hasSitePermission(currentModule.getPermissionName(), site.getSiteKey()) || hasServerPermission(currentModule.getPermissionName())) {
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

        if (key.contains("@")) {
            baseName = StringUtils.substringAfter(key, "@");
            key = StringUtils.substringBefore(key, "@");
        }
       
        String value = new JahiaResourceBundle(baseName, locale, site != null ? site.getTemplatePackageName() : null).get(key, null);
        if (value == null || value.length() == 0) {
            value = JahiaResourceBundle.getJahiaInternalResource(key, locale);
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Resources value: " + value);
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

            messageMaps.put(locale, messageMap);
        }
        String message = messageMap.get(msgKeySuffix);
        if (message == null) {
            JahiaTemplatesPackage aPackage = getDeclaringNodeType().getTemplatePackage();
            message = new JahiaResourceBundle(getResourceBundleId(), locale, aPackage!=null ? aPackage.getName(): null, JahiaTemplatesRBLoader
                    .getInstance(Thread.currentThread().getContextClassLoader(), null)).getString(
                    getResourceBundleKey() + (!StringUtils.isEmpty(msgKeySuffix) ? "." + msgKeySuffix : ""), "");
            messageMap.put(msgKeySuffix, message);
        }
        return message;
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

    public String getLabel(Locale locale) {
        String label = labels.get(locale);
        if (label == null) {
            String key = getName().replace(':', '_');
            String tpl = getTemplatePackage() != null ? getTemplatePackage().getName() : null;
            label = new JahiaResourceBundle(getResourceBundleId(), locale, tpl, JahiaTemplatesRBLoader
                    .getInstance(Thread.currentThread().getContextClassLoader(), tpl)).getString(key, StringUtils.substringAfter(getName(),":"));
            labels.put(locale, label);
        }
        return label;
    }
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

    public String getDescription(Locale locale) {
        String description = descriptions.get(locale);
        if (description == null) {
            String key = getName().replace(':', '_') + "_description";
            String tpl = getTemplatePackage() != null ? getTemplatePackage().getName() : null;
            description = new JahiaResourceBundle(getResourceBundleId(), locale, tpl, JahiaTemplatesRBLoader
                    .getInstance(Thread.currentThread().getContextClassLoader(), tpl)).getString(key, "");
            descriptions.put(locale, description);
        }
        return description;
    }
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

*/
public class ResourceBundleChoiceListInitializerImpl extends AbstractChoiceListRenderer implements ChoiceListInitializer {

    public List<ChoiceListValue> getChoiceListValues(ExtendedPropertyDefinition epd, String param, List<ChoiceListValue> values, Locale locale,
                                                     Map<String, Object> context) {
        JahiaResourceBundle rb = new JahiaResourceBundle(null, locale, getTemplatePackageName(epd));

        if (values == null || values.size() == 0) {
            List<ChoiceListValue> l = new ArrayList<ChoiceListValue>();
            String[] constr = epd.getValueConstraints();
            for (String s : constr) {
                ChoiceListValue bean = new ChoiceListValue(rb.get(epd.getResourceBundleKey() + "." + s.replace(':', '_'), s), new HashMap<String, Object>(),
                                                           new ValueImpl(s, PropertyType.STRING, false));

                l.add(bean);
            }
            return l;
        } else {
            for (ChoiceListValue choiceListValue : values) {
                final String displayName = choiceListValue.getDisplayName();
                choiceListValue.setDisplayName(rb.get(epd.getResourceBundleKey() + "." + displayName.replace(':', '_'),
                                                      displayName));
            }
            return values;
        }
    }
View Full Code Here

Examples of org.jahia.utils.i18n.JahiaResourceBundle

    public String getStringRendering(Locale locale, ExtendedPropertyDefinition propDef,
            Object propertyValue) throws RepositoryException {

        String propValue = propertyValue.toString();

        JahiaResourceBundle rb = new JahiaResourceBundle(null, locale, getTemplatePackageName(propDef));

        return rb
                .get(propDef.getResourceBundleKey() + "." + propValue.replace(':', '_'), propValue);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.