Rhesa,

I just finished 2 English / French sites. I found that keeping my English
files in the root template folder, and then having a French folder in the
template folder with 'copies' of the English templates was fairly easy to
manage.

It meant I could default my system to run from the English templates, and
then when in French mode, I just had to have C::A add a '/fr' to my template
path in-order to read from the French folder.

Don't forgot, you'll probably need a French and English images folder too,
for all those pesky images that have text in them.

I'd also suggest not having any error messages in your C:A code, but instead
have them set inside the templates. So if something dies with an error,
don't code:

$t->param( 'error' => 'There was a problem processing your request' );

but instead code:

$t->param( 'error' => 1 );
$t->param( 'errormessage.problem' => 1 );

and then have the template file use

<tmpl_if name='error'>
   <tmpl_if name='errormessage.problem'>There was a problem processing your
request</tmpl_if>
<tmpl_if>

Setting 2 error flags, means you can use one in the template as the general
"Yes there was an error", and the other to display the specific error
message in the proper language from within the template.

Another small gotcha might be email subject lines. Make sure you have those
saved in a config file or something for either French or English. I had a
tendency to use really simple "Your password reminder" style subject lines
built right into my code, but I had to change that when I first needed to
figure out if I was sending the email in English or French.

As for number and date formatting. It shouldn't be too hard to create too
small library modules that contain only formatting functions. One for
English, one for French, each would have formatting for dates, dollar
amounts, etc. Then whenever you needed to format something before returning
it to the template, just send it off to the proper language formatter.

You might want to define which is "the proper" language formatter somewhere
near the top of your app so you don't have to do it in every run-mode. Make
it very simple for each run-mode to access the correct formatter without
having to know specifically which one it is accessing.

Hope that helps.

---
Steve Comrie

> Hello all,
>
> I'm facing the refactoring of a cgi-app/html-template based site to
> support multiple languages, and I'd like to get the design right.
>
> I'm curious how you are dealing with multi-lingual sites. How do you
> prefer to organise your templates? How do you handle date and number
> formatting?
>
> I can imagine overriding load_tmpl to transparently get the correct
> language template, but am not quite sure how to handle this. Should I
> use directories for each language (e.g. en/home.html, fr/home.html), or
> use suffixes (e.g. home.html.en, home.html.fr)?
>
> Dealing with dates and numbers is not something I can see being done
> inside the templates (unless I would adopt another templating system, or
> html-template-expr). Number::Format looks cool, as does
> Locale::MakeText. I'm already using DateTime as my prefered datetime
> framework, and with DateTime::Locale that should be easy to cover as
> well. The only thing I cannot yet see through the fog is how to
> integrate all that cleanly into the app.
> I suppose Locale::MakeText could potentially also answer any issues I
> might face with ValidateRM.
>
> Thoughts, comments and tips welcome!
>
> Rhesa Rozendaal
>
> PS. Currencies! rats...


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to