Re: More ideas for translation support (long)
| From: | KaalH! | Date: | Tue, 24 Jul 2001 10:11:00 +0000 |
| Subject: | Re: More ideas for translation support (long) | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1274@lists.php.net to get a copy of this message | ||
hello,
personnaly, I'm using gettext as a custom modifier :
define('BASE_DIR',dirname(__FILE__));
$language = 'fr';
setlocale(LC_ALL, $language);
bindtextdomain('myApp', BASE_DIR . '/locale');
textdomain('myApp');
// refer to './locale/'.$language .'/LC_MESSAGES/myApp.mo'
$smarty->register_modifier("_","_");
in the config file :
_title = English title
in the template :
<title>{#_title#|_}</title>
extract all _* config vars and pass them to 'xgettext --keyword=_ -C '. you've got a nice po file ready to translation.
see http://www.gnu.org/software/gettext/gettext.html and http://www.php.net/manual/en/function.gettext.php for gettext doc.
I only got one template, and one config file for all languages. for caching, I'm using $language as part of the cache id.
--
KaalH!