среда, 12 августа 2009 г.

JBoss Seam - whole localized page

A lot of time was spent before so simple approach to come into my mind :)
All internet search regarding JSF / JBoss Seam localization / internationalization describes how either on low level working with JSP perform support of localized pages or how to attach localized messages.properties. But I'm using JBoss Seam and need to create pretty complex localized pages so it's much easier to create the whole *.xhtml localized page to include into the accessed page.
... And so simple solution: use messages.properties to point to the localized *.xhtml content.

Example.
Let's assume we want to create the support.xhtml page with complex localized content. Let's put that content into the /i18n/support_en.xhtml

support.xhtml page now should contain the skeleton only (everything around the localized content) and include that content in the corresponding place:


<ui:include src="#{messages.support_content}" />


Than in messages.properties and messages_en.properties we include the following:


support_content=/i18n/support_en.xhtml


In messages_ru.properties we include:


support_content=/i18n/support_ru.xhtml


Et cetera. Now I believe you've already got the point...