The final topic of this tutorial is performance. Obviously adding translation is going to impact on the site performance, and the more text to be translated the higher this impact will be. Certain formats are inherently 'better' for performance - at least at the actual translation level - than others, but thankfully in Scorpio, and so long as Smarty is being used, the impact is largely removed.
As previously mentioned the translation in Smarty is handled before the templates are compiled i.e. the translated text in the requested language is actually compiled into the Smarty template cache files. The upshot of this, is that once the page has been translated it does not need to happen again, unless the cache is cleared.
When a template translation is requested, Scorpio automatically passes in the locale to the render and compile functions. This is automatically added to the compile and cache ids during the compile and render phases.
The benefit of this is a compiled template cache for each language, already prepared in whatever language was requested. Your visitors need never know - and Smarty is saved from having to prefilter all the text. Better still: those compiled pages can be cached completely in the language even eliminating the need to compile.
Of course, pre-filling the cache is important - especially if there is a lot of text or you have very largely (or numerous) translation resources.
Posted by: Dave Redfern (Writer), in Tutorials on 07 Sep 2009 @ 22:54
Tags: languages, translation system, tutorial,
Contents:
This
work is licenced under a
Creative Commons Licence.