[geeklog-devel] Question about internationalization and look-ups
Michael Jervis
mjervis at gmail.com
Sun Feb 17 10:24:14 EST 2008
> So what happens when 2 different modules use the same key for two
> different meanings?
Ah see, there is one language file per controller. Only one controller
is loaded at once. i.e. you can't be on the home page AND on the
artist list page at the same time. Only one. So the indexes don't
collide, ever. They can't.
Also, the intention was to pass in "Some english string" and only put
a mapping for that in so I could pass them to translators, but in the
live site have empty arrays for English for performance reasons. At
one point I had "tokens" instead of production strings, and they still
hang over in that one language file. Thanks for spotting I can fix
that now ;-)
Er and also if I pass in Some english string and that's defined as a
key in two files, it should have the same translation and it'll just
get de-duplicated by array_merge.
> 2) By tradition, no default language file is loaded first.
Mine doesn't /need/ a language file loaded first. It'll put text out
in en_gb without any language files. And if the yank I run the site
with with doesn't like his colours, he can translate it all to US by
hand, or, more importantly, only translate the strings that differ, so
where we mention colour or centre, he can translate it. Where both
sides of the pond differ, no need to add a translation, keeping the
files small.
> Refactoring GL1 to solve these two problems would not be hard, just tedious.
Well, my solution isn't for GL1 anyway. It's for another project. It
/may/ be of interest to Tony for GL2 or whatever he's working on if
that clip of code isn't Geeklog related at all.
> Actually, your method suffers the same problem as GL1. You either
> load a specific language file or the english file. So if the
> alternate language file is out of sync, you potentially have missing
> text. Makes more sense to do this (both in GL1 and your translate class):
As noted in my first email, if the French file lacks the translation
for "Go eat garlic" that I added to the next version of the site,
they'll just get a "Go eat garlic" text instead of Venez manger garlic
(or whatever, I'm no French expert either...)
> while the French cached version might be (I'm no expert in French):
I feel sorry for the French, bought my toddler a thing where you wack
egg things on the head and they drop into cars and whizz off. Every
translation except the French on the back of the packet was Pop, Wack,
Whizz! The French one was "Place the driver in the top, tap him on the
head with the provided mallet, and off he goes!" how dull...
More information about the geeklog-devel
mailing list