Package org.jvnet.localizer

Examples of org.jvnet.localizer.ResourceBundleHolder.format()


        String key = i.displayName();
        if (key.length()==0return c.getSimpleName()+"."+e.getName();
        try {
            ResourceBundleHolder rb = ResourceBundleHolder.get(
                    c.getClassLoader().loadClass(c.getPackage().getName() + ".Messages"));
            return rb.format(key);
        } catch (ClassNotFoundException x) {
            LOGGER.log(WARNING, "Failed to load "+x.getMessage()+" for "+e.toString(),x);
            return key;
        } catch (MissingResourceException x) {
            LOGGER.log(WARNING, "Could not find key '" + key + "' in " + c.getPackage().getName() + ".Messages", x);
View Full Code Here


                try {
                    // command name
                    final String name = m.getAnnotation(CLIMethod.class).name();

                    final ResourceBundleHolder res = loadMessageBundle(m);
                    res.format("CLI."+name+".shortDescription");   // make sure we have the resource, to fail early

                    r.add(new ExtensionComponent<CLICommand>(new CloneableCLICommand() {
                        @Override
                        public String getName() {
                            return name;
View Full Code Here

                            return name;
                        }

                        public String getShortDescription() {
                            // format by using the right locale
                            return res.format("CLI."+name+".shortDescription");
                        }

                        @Override
                        public int main(List<String> args, Locale locale, InputStream stdin, PrintStream stdout, PrintStream stderr) {
                            this.stdout = stdout;
View Full Code Here

                            return name;
                        }

                        public String getShortDescription() {
                            // format by using the right locale
                            return res.format("CLI."+name+".shortDescription");
                        }

                        @Override
                        public int main(List<String> args, Locale locale, InputStream stdin, PrintStream stdout, PrintStream stderr) {
                            this.stdout = stdout;
View Full Code Here

        try {
            ResourceBundleHolder rb = ResourceBundleHolder.get(c.getClassLoader().loadClass(c.getPackage().getName() + ".Messages"));

            String key = i.displayName();
            if (key.length()==0return c.getSimpleName()+"."+e.getName();
            return rb.format(key);
        } catch (ClassNotFoundException x) {
            LOGGER.log(FINEST, "Failed to load "+x.getMessage()+" for "+e.toString(),x);
            return c.getSimpleName()+"."+e.getName();
        }
    }
View Full Code Here

                try {
                    // command name
                    final String name = m.getAnnotation(CLIMethod.class).name();

                    final ResourceBundleHolder res = loadMessageBundle(m);
                    res.format("CLI."+name+".shortDescription");   // make sure we have the resource, to fail early

                    r.add(new ExtensionComponent<CLICommand>(new CloneableCLICommand() {
                        @Override
                        public String getName() {
                            return name;
View Full Code Here

     */
    public static Map<Notify, String> notificationLevelTextsById() {
        ResourceBundleHolder holder = ResourceBundleHolder.get(Messages.class);
        Map<Notify, String> textsById = new LinkedHashMap<Notify, String>(Notify.values().length, 1);
        for (Notify level : Notify.values()) {
            textsById.put(level, holder.format("NotificationLevel_" + level));
        }
        return textsById;
    }

   /**
 
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.