That works really well Gary. My site is a full xml view with .xml
remapped to .tru. I've got two clay configs that I'm using, one to
define widgets and layouts, the other to define pages.
My layout is defined like this in clay-config.xml:
<!-- Base page layout. Should be extended by other page layouts
-->
<component jsfid="layout" extends="clay">
<attributes>
<set name="clayJsfid"
value="/layouts/layout.html" />
</attributes>
</component>
<!-- Standard page with navigation and static content -->
<component jsfid="standardNavStatic" extends="layout">
<symbols>
<set name="@head"
value="/layouts/head_standard.html"/>
<set name="@leader"
value="/layouts/header_nav.html"/>
<set name="@navigation"
value="/layouts/navigation.html"/>
<set name="@content"
value="/layouts/content_static.html"/>
<set name="@footer"
value="/layouts/footer.html"/>
</symbols>
</component>
The tile that makes up the body of the final page is defined in @content
and it's a very simple clayImport, so content_static.html is just:
<span jsfid="clayImport" url="@page" xmlEncode="false"/>
Then in my other clay config, called clay-tiles-config.xml I define a
page called help_page.tru and set the value of the @page symbol:
<component jsfid="/content/help_page.tru"
extends="standardNavStatic">
<symbols>
<set name="@page"
value="/content/#{view.locale}/help_page.html" />
</symbols>
</component>
And just provide the content in /content/en/help_page.html
<h3>Hello</h3>
Or /content/fr/help_page.html
<h3>Bonjour</h3>
The only little wrinkle is that I must provide a default locale in
faces-config to make sure that the locale is always present...
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
So now hitting localhost:8080/mysite/content/help_page.tru with my
locale as English I get the message Hello, and with my local set to
French I get Bonjour.
Nice :-)
On a slightly different subject, does anyone know of a full list of the
top level values (such as #{view}) that are available in the
facesContext?
Cheers,
Ian.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 14 July 2006 16:11
> To: [email protected]
> Subject: Re: Internationalisation: Embedded HTML markup in
> Message Bundles?
>
> >From: "Ian.Priest" <[EMAIL PROTECTED]>
> >
> > The site I'm working on has quite a lot of largish static pages
> > containing help info, user guides etc. There's quite a lot
> of mark-up
> > in the pages, for example:
> >
> >
> ><h3>help section 1</h3>
> ><p>some useful info</p>
> ><p>some more useful info</p>
> >
> > I need to make the content multi-language, and can think of
> a couple
> > of ways to go about it.
> >
> > 1. The obvious: use a message bundle. The problem I can see
> with this
> > is that (afaik) it's not possible to put html markup into a message
> > bundle and have it rendered on the page. It's generally treated as
> > part of the text and displayed by the browser instead of
> being used to
> > format the text. Hence even the tiny snippet above would
> require three
> > entries in the message bundle. With the pages I'm looking
> at the grand
> > total of entries in the message bundle would be into 4 figures!
> >
> > 2. Use the current locale to load files from a dynamic url, (I use
> > clayImport to pull them into my layout), so I'd have
> > /static_content/en/, /static_content/fr/, and then have an English,
> > French etc. copy of each html page.
> >
>
> You might try a bit of EL here.
> url="/static_content/#{view.locale}/xxx.html"
>
> I'm not sure about this one because the expression of the url
> is evaluated early and not managed as a ValueBinding object.
>
>
> > Personally I lean towards the second solution, but was
> curious whether
> > there is some clever Clay-way of getting markup from a
> message bundle to
> > actually be used as markup by the browser?
> >
>
> This might be something that would be worth adding to the
> clayInput or a one-off of it.
> If you come up with some new flavor, please share it.
>
>
>
> > Cheers,
> > Ian.
> >
>
> Gary
>
> >
> >
>