Book Image

Tapestry 5: Building Web Applications

Book Image

Tapestry 5: Building Web Applications

Overview of this book

Table of Contents (17 chapters)
Tapestry 5
Credits
About the Author
About the Reviewers
Preface
Foreword
Where to Go Next

Using Localized Templates


Many applications have pages with significant textual content and very few components on them, if any. These can be pages with legal information, terms and conditions and so on. Internationalizing such pages paragraph by paragraph, placing all text into message catalogs, doesn't sound like a good idea. Fortunately, Tapestry has an alternative solution for this purpose—localized templates.

Let's add yet another page to the application, and this one will be extremely simple. First add a new empty class to the package containing all the other page classes and name it Terms.

Next, add to the application two new templates, one of them named Terms.tml, another one Terms_de.tml. In real life we would put some lengthy English text into the Terms.tml file while its German translation would go into the Terms_de.tml. However to save space, we'll make the content of these files very simple, just enough to see that they are different. This is what Terms.tml might look like:

&lt...