messageformat

Should I use java.text.MessageFormat for localised messages without placeholders?

We are localising the user-interface text for a web application that runs on Java 5, and have a dilemma about how we output messages that are defined in properties files - the kind used by java.util.Properties. Some messages include a placeholder that will be filled using java.text.MessageFormat. For example: search.summary = Your sear...

Can I escape braces in a java MessageFormat?

I want to output some braces in a java MessageFormat. For example I know the following does not work: MessageFormat.format(" public {0} get{1}() {return {2};}\n\n", type, upperCamel, lowerCamel); Is there a way of escaping the braces surrounding "return {2}"? ...

Benefits of MessageFormat in Java

In a certain Java class for a Struts2 web application, I have this line of code: try { user = findByUsername(username); } catch (NoResultException e) { throw new UsernameNotFoundException("Username '" + username + "' not found!"); } My teacher wants me to change the throw statement into something like this: static final Strin...

How do I format a long integer as a string without separator in Java?

Simple question, but I'll bet that asking on here will probably be more straight forward than trying to understand the documentation for MessageFormat: long foo = 12345; String s = MessageFormat.format("{0}", foo); Observed value is "12,345". Desired value is "12345". ...

Test for null parameter in .properties file for MessageFormat

Is it possible, with resource bundles and MessageFormat to have the following result? when I call getBundle("message.07", "test") to get "Group test" when I call getBundle("message.07", null) to get "No group selected" Every example I found on the Internet is with planets, with files on the disk and so on. I only need to check if o...

Aligning messageformat on printing a JTable.

I'm using this for the moment to print out my table, and it works. But I'm not really happy with the layout of the messageformatting, I would like to have both pagenumber and date in the footer, and date format aligned to the left side of the table, and page to the right. How can I do that? Been reading some stuff about overriding the P...

Can you get access to the NumberFormatter used by ICU MessageFormat

This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand. When using the MesssageFormat class, is it possible to get access to the NumberFormat object it uses to format currency strings. When you create a NumberFormat instance yourself, you can specify a...

difference between MessageFormat.format and String.format in jdk1.5?

difference between MessageFormat.format and String.format in jdk1.5? ...

Is the Java MessageFormat Class thread safe? (as opposed to SimpleThreadFormat)

I know that SimpleDateFormat and NumberFormat are NOT thread safe. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4101500 But what about the other Format classes like MessageFormat? Fortify 360 is flagging the use of "MessageFormat.format(String, Object...)" static method as a "Race Condition - Format Flaw" issue, but when I analyz...

If unspecified, what is the default value for MessageStorage in a Notes Person document?

I'm having issues figuring out where it's grabbing the default value. I tried changing the message format field under the Mail tab in the Location document, but that didn't change the default message format when making person docs. ...