Re: [Templates] internationalization support (i18n)

[prev] [thread] [next] [Date index for 2005/06/02]

From: Birgit Kellner
Subject: Re: [Templates] internationalization support (i18n)
Date: 09:06 on 02 Jun 2005
Daniel Schmeck wrote:

>I use the template toolkit for generating static html pages. At the moment are 
>all templates with german content.
>
>For the future I'm going to generate every page two times. One page with 
>german content, the other page with english content. Images, outgoing links, 
>layout are the same on both pages. The only difference is the translation of 
>the text.
>
>At the start of the web page the user can choose the german or the english 
>pages. If you choose the german pages the menu and the content is german.
>
>What's the best approach to doing this? Are there any plugins or frameworks 
>for this?
>
>If not, what options do I have to realize it myself?
>
>My source templates are plain text files . Are xml source templates better for 
>internationalization?
>
>I'm thinking over this options:
>
>a) different templates,
>
>b) multiple strings in the same template or
>
>c) multiple elements in a xml file.
>
>With best regards
>Daniel Schmeck
>  
>
I am in the process of doing something similar for a system that partly 
serves dynamic pages, and partly generates static pages in both German 
and English. My approach is hand-made, and I'm sure something more 
professional is somewhere out there, but perhaps it's still useful to you.

For the static pages, I have only header and footer templates; the 
headings (which are also used as titles in the html header) and the 
actual page content are stored in a MySQL database and edited there. 
Header and content are updated only in the MySQL table, which also has a 
language-field that stores what language the page will be in (based on 
this value, the file is written to a specific directory in the directory 
hierarchy), and a field for storing the actual file's name. In the MySQL 
database, page content is written in Textile code.

A perl script generates the pages, reading header and page content for 
each page from the database into $vars, which is then passed on to the 
Template module that processes a main page template.

Navigation menus are also parsed: based on the language value of a page, 
the perl script sets the file name of the appropriate navigation menu 
template ("navbar_ger.tmpl", "navbar_eng.tmpl"). This is stored in 
$vars->{navbar} and read into the header and footer templates with

*<div* class="navbar"*>*
<% include "$navbar" %>
*</div>*


There is a very simple (plain text) main page template which looks like 
this:

<% include header.tmpl %>
<h1><% page_heading %></h1>
<% page_content %>
<% include footer.tmpl %>


All of this is basically a somewhat primitive CMS that creates the pages 
for you. At any rate, I would advise against using different page 
templates for individual langauges - after all, it's the content that 
varies, while the layout remains the same, so why use different 
templates and make maintenance more difficult?

Hope this is useful,

best regards,

Birgit Kellner






_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] internationalization support (i18n)
Daniel Schmeck 20:14 on 01 Jun 2005

Re: [Templates] internationalization support (i18n)
Birgit Kellner 09:06 on 02 Jun 2005

Re: [Templates] internationalization support (i18n)
Thomas Klausner 09:48 on 02 Jun 2005

Re: [Templates] internationalization support (i18n)
Sebastian Riedel 11:29 on 02 Jun 2005

Re: [Templates] internationalization support (i18n)
Daniel Schmeck 18:25 on 05 Jun 2005

Generated at 20:13 on 05 Jun 2005 by mariachi v0.52