Results 1 to 2 of 2

Thread: Support for ChoiceFormat?

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Posts
    6

    Default Support for ChoiceFormat?

    Hi,

    I am trying to figure out what is the best way to use a ChoiceFormat from Spring.

    It seems that all the i18n support is based on a MessageFormat that can't be "parameterized" (the one returned from the createMessageFormat() method of the AbstractMessageSource class).

    This means that if I need to use a ChoiceFormat, I do have to write a subclass of AbstractMessageSource, but then loose the "flexibility" of the ResourceBundleMessageSource and the reloadable equivalent. Wouldn't it be nicer if the "strategy" of message formats was somehow externalized from the AbstractMessageSource?

    Any idea on how to elegantly solve this issue?

  2. #2
    Join Date
    Aug 2004
    Posts
    6

    Default Re: Support for ChoiceFormat?

    After digging intensively in the JDK doco, I found the following way of using a choice format:

    pattern=There {0,choice,0#are no files|1#is one file|1<are {2} files} on {1}

    Quite tricky, but hey it works :-)

Similar Threads

  1. Replies: 7
    Last Post: Feb 1st, 2007, 01:47 AM
  2. Announcement: Spring IDE WebFlow Support Preview Release 2
    By Christian Dupuis in forum Announcements
    Replies: 2
    Last Post: Sep 15th, 2006, 11:50 AM
  3. Replies: 2
    Last Post: Sep 7th, 2005, 07:10 AM
  4. DAO Support without EJB Support
    By aryjr in forum EJB
    Replies: 1
    Last Post: Jul 11th, 2005, 10:40 AM
  5. New Spring Support Forums are Live
    By Colin Sampaleanu in forum Announcements
    Replies: 17
    Last Post: May 22nd, 2005, 12:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •