Examples of XmlBundle


Examples of ir.xweb.util.XmlBundle

        this.bundleDir = properties.getFile(PROPERTY_RESOURCE_BUNDLE_DIR,
                new File(manager.getContext().getRealPath("bundle")));
        final File defaultBundle = new File(DEFAULT_BUNDLE, DEFAULT_BUNDLE + ".xml");
        if(defaultBundle.exists()) {
            try {
                bundles.put(DEFAULT_BUNDLE, new XmlBundle(defaultBundle));
            } catch (Exception ex) {
                new IllegalArgumentException("Illegal default bundle file: " + defaultBundle, ex);
            }
        }
View Full Code Here

Examples of ir.xweb.util.XmlBundle

    public String getString(final String language, final String key, final String defaultValue) {
        final String l = language == null ? defaultLanguage : language;

        // try to load bundle if is not loaded
        XmlBundle b = bundles.get(l);
        if(b == null) {
            final File f = new File(this.bundleDir, l + ".xml");
            if(f.exists()) {
                try {
                    b = new XmlBundle(f);
                    bundles.put(l, b);
                } catch (Exception ex) {
                    logger.error("Error to load bundle file (" + l + "): " + f);
                }
            }
        }

        final String result = b == null ? defaultValue : b.getString(key);

        return result == null ? key : result;
    }
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.