[Catalyst] structure/layout of multilingual web application

Dominique Quatravaux dom at idealx.com
Wed Jul 13 11:12:44 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zbyszek Lukasiak wrote:

> Dear All,
>
> I looking for any advices in the subject of architecture of a
> multilingual web application,

I recommend you pay a particular attention to the parts of the
database contents that will need I18N, because with an SQL database
this is bound to become a royal PITA. E.g. every "name" column in
table "foo" has to be turned into an ancillary table with (foo INTEGER
NOT NULL REFERENCES foo (id), lang VARCHAR(10), name TEXT) to store
names in different languages.

In order for e.g. radio button values to be interoperable between
languages, you want to define language-neutral technical symbols for
the values of every multiple-choice widget in your app (e.g.
GENDER_MALE / GENDER_FEMALE) and arrange for the translation of same
(in the visible part of the HTML code) to be done according to
language (Man / Woman, Homme / Femme, Mann / Frau etc.) This may or
may not involve making use of maketext and/or the database transform
described above.

As you probably know quite well, there is more to I18N than text
translation (character sets for starters - have a look at
Catalyst::Plugin::Unicode)

Also there is the story of keeping the app's URLs intellegible in the
user's language, I don't have any bright ideas about this one (I
simply don't try to implement that :-). You would probably need to
hack into the Catalyst core for that.

Finally, I18N is V's and C's problem only (C knows prefererred lang
from session and/or Accept-Language: request header, V honors that by
choosing a text of the appropriate language where appropriate). The
only thing M should know about I18N is that text renditions of stuff
are hash-like structures keyed on lang instead of single strings, see
above.

> and more precisely - what to use for choosing the language -
> special language parameter, a path prefix or perhaps a cookie?

The preferred language is a user session parameter among others, so
you should investigate the session management mechanisms in general
(start with the Catalyst::Plugin::Session::* modules from CPAN)


>
> By the way I could not use the Catalyst I18N plugin - as it has
> perl 8.6 in it's dependency tree, but I think it could be simpler
> to use if it added the 'l' function (maketext method) to the stash
> so that there would not be need for creating a shortcut macro.

Perl 5.8 will probably be needed for a lot of Catalyst things, better
be prepared to upgrade (I found I had to). Plus it really deals better
with UTF-8 than 5.6

- --
Dominique QUATRAVAUX                           Ingénieur senior
01 44 42 00 08                                 IDEALX

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC1NsMMJAKAU3mjcsRAtDTAJ9uXJt4DnKJUnIN7LJNH02hkjwKtgCfYZMe
OyN+8coRkMpKrQu4UIODeu4=
=s61T
-----END PGP SIGNATURE-----





More information about the Catalyst mailing list