On 1/9/07, Pascal Fleury <[EMAIL PROTECTED]> wrote:
> On Tuesday 09 January 2007 14:41, Oliver Jeeves wrote:
> > > % if ($Lang eq 'ES') {
> > > ...
> > > % } else {
> > > ...
> > > % }
> >
> > Using if() {} else {} is an ugly, ugly solution. Especially if you're
> > going to have multiple languages, or want the ability to add new
> > languages later. It's also much more prone to errors - missed closing
> > braces etc. - then other methods.
>
> besides the fact that most i18n/l10n tools enable you to have fallback modes,
> like 'fr_CA' (Canadian french) falls back to 'fr' if not provided. that makes
> the if/else solution unworkable too.
>
> The idea about letting the Mason parser produce separate files based on
> language may seem nice, but I wonder if the gain in computation is really
> that substantial. Especially when there are queries to remote DBs, reading
> sessions, multiple components, etc. making the translation overhead a small
> part of the total cost, my gut feeling is that this is better handled with
> things like caching (Mason component caching) or network/browser caching
> (with all its pitfalls).
>
> Has anybody measured this once ? I guess not :-)
We use the technique described in the Audrey's doc in the RT project
and I can confirm that performance penalties from a business logic are
much bigger than added by localization calls. At least I've never seen
loc() on top places in results from a profiler. However for
micro-optimization I can suggest avoid <&|/l, $args...&>Single line of
text</&> syntax and use perl function call (something like <% loc(...)
%>) as the former calls mason component which adds some (most probably
small enough) overhead.> > > > > Baldvins quite right in that my earlier solution wasn't particularly good; > > you don't want to duplicate any work changing layout for each language you > > have. > > --paf > -- > --paf > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Mason-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mason-users > -- Best regards, Ruslan. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Mason-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mason-users

