http://ofbiz.116.s1.nabble.com/jira-Created-OFBIZ-203-Freemarker-postal-address-formatter-macro-tp171329p171335.html
> [
http://issues.apache.org/jira/browse/OFBIZ-203?page=comments#action_12434342 ]
>
> Leon Torres commented on OFBIZ-203:
> -----------------------------------
>
> Hi David, I wanted only to present counterarguments for the benefit of other readers. :-)
>
> I'll post to the list about my approach after I review for the above concerns. However, I wish to address the complexity argument above.
>
> Presently, the supported features of this macro are,
>
> 1. Format according to country postal formats
> 2. Output in HTML or text.
> 3. Easily support any future output modes (XSL:FO).
> 4. For formats that need it, offer an inline option (text and XSL:FO, HTML can use CSS)
> 5. As a bonus, print the country name on the last line if the address' country does not match the user's country locale
>
> If a user wanted to support France, he'd just copy one of the existing AddressFormatter classes and tweak it a little. There's really nothing much going on in them. The present examples for ENGL, USA and DEU span nearly all possible use cases. If I then write the rules to generate XSL:FO output, none of the existing formatters need to be updated! How neat is that? :-)
>
> I'd also like to point out this approach is no different from @ofbizCurrency, which uses an external API to handle the locale specific formatting. The only difference is the API for formatting addresses is homebrew.
>
> Replicating all this in FTL would be challenging, although I would welcome any suggestions on how it would work.
>
> Again, for people interested in this, I would recommend looking at the test files. Add some German, British and French postal addresses and see what happens. :-)
>
> > Freemarker postal address formatter macro
> > -----------------------------------------
> >
> > Key: OFBIZ-203
> > URL:
http://issues.apache.org/jira/browse/OFBIZ-203> > Project: OFBiz (The Open for Business Project)
> > Issue Type: New Feature
> > Components: framework
> > Affects Versions: SVN trunk
> > Reporter: Leon Torres
> > Priority: Minor
> > Attachments: ofbizPostalAddress.patch, test.bsh, test.ftl
> >
> >
> > Define a macro <@ofbizPostalAddress address=inputMapOrGenericValue/> to format postal addresses in a consistent, flexible way with attention to country postal formats. The output should support both HTML and Text formats. It should be easily extensible, with future XSL:Fo support in mind.
> > I created an implementation as an exercise to learn the freemarker template system. It was designed with future macros in mind. Currently implemented are rules for generating US, German and Royal Mail format postal addresses. (The address country determines the format.) Also provided are test.bsh and test.ftl so people may try them out.
>