Re: Is MessageFormat supported?
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Wednesday, October 21, 2009, 6:00:03 PM, [email protected] wrote: > I'm trying to use MessageFormat in combination with FM's localization > feature but I'm having some problems (which I won't go into at this time). > My question is, are there features in FreeMarker (builtins, for example) > that help with this and that may save me some effort? I don't see anything > in the online manual, but maybe I'm missing something. freemarker.ext.beans.ResourceBundleModel deals with this, AFAIR. ResoureBundles should be wrapped into it automatically, so it's not like you should know about this class. Just drop a ResourceBundle into the data-model, then the resulting variable will be (copy-paste from the JavaDoc): A hash model that wraps a resource bundle. Makes it convenient to store localized content in the data model. It also acts as a method model that will take a resource key and arbitrary number of arguments and will apply MessageFormat with arguments on the string represented by the key. Typical usages: * bundle.resourceKey will retrieve the object from resource bundle with key resourceKey * bundle("patternKey", arg1, arg2, arg3) will retrieve the string from resource bundle with key patternKey, and will use it as a pattern for MessageFormat with arguments arg1, arg2 and arg3 -- Best regards, Daniel Dekany ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference