Re: i18n

From: Date: Fri, 29 Aug 2003 16:10:02 +0000
Subject: Re: i18n
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10156@lists.php.net to get a copy of this message
At 11:39 AM 8/29/03, Javier Tacón wrote:
Anyone knows if exists any system to manage the internalization under Smarty? Thanks Javier Tacón - Developer Private Media Group, Inc. www.prvt.com (Nasdaq: PRVT)
Hi Javier! We haven't done it yet, but we have plans to internationalize a large Smarty site. We plan to take advantage of PHP's built-in support for gettext(): http://www.php.net/manual/en/ref.gettext.php That will take care of the translation of any strings that originate in PHP code. To handle strings in Smarty templates, we need two things: A Smarty Plugin to make the necessary calls to gettext(), and a utility to parse our templates and create a file that the gettext utilities can use to identify strings for dictionaries. The Smarty plugin will be a block plugin, with tags that look like this: {gettext}Hello, World!{/gettext} {gettext}This is cool!{/gettext} Our utility will parse template files, and create a dummy PHP file with lines like this: gettext( 'Hello, World! ); gettext( 'This is cool!' ); We will then use the gettext utilities to create the translation library. The Smarty plugin will call gettext() to translate any strings in {gettext} tags. Voila! As to other aspects of internationalization, such as date, time and currency formatting, we will need to add a bit of intelligence to the plugins that format those things now. (Of course everyone already neatly encapsulates such formatting in Smarty plugins, right?) When we actually complete such a project, I will write it up in more detail and add it to the Wiki or something. -- Mike van Lammeren Web Application Developer Emerge2 Digital Inc., "evolving business to digital" Web: http://www.emerge2.com Email: mike@emerge2.com

« previous php.smarty.general (#10156) next »