![]() |
|
P is for Practical | |
PerlMonks |
Re: Multilingual designby cavac (Vicar) |
on Dec 16, 2022 at 09:57 UTC ( #11148919=note: print w/replies, xml ) | Need Help?? |
My own webserver uses TT. Text in the templates is defined in English, but with a translate callback, something like this:
Basically, i'm registering a plugin into TT that provides a few functions. That includes making variables websafe as well to reduce the possibility of code injection. I haven't touched that particular code in a long, long time, but basically, you start by creating a TT plugin module
And then you provide that plugin when instatiating the Template Toolkit:
And since you provide the original, untranslated text in the Template, you can return that as default when no translation is found. Plus, automatically add it to the "still to be translated" list. Original codebase of mine is open source.
PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
In Section
Seekers of Perl Wisdom
|
|