RE: [SMARTY] i18n

From: Date: Fri, 25 Apr 2003 22:22:39 +0000
Subject: RE: [SMARTY] i18n
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-9381@lists.php.net to get a copy of this message
Hi guys, I've been using this excellent i18n plugin http://jellycan.com/langselect/index.php?lang=en and I'm really happy with it. It's easy to implement and works like a charm. Tnx to Brodie Thiesfield and Alejandro Sarco for this excellent plugin. Eduardo Morales > -----Original Message----- > From: gsstark@mit.edu [mailto:gsstark@mit.edu] > Sent: Friday, April 25, 2003 11:32 AM > To: Linus McCabe > Cc: Greg Stark; smarty-general@lists.php.net > Subject: Re: [SMARTY] i18n > > > Linus McCabe <linus@mccabe.nu> writes: > > > I use gettext for translations. This requires php with gettext > extensions > > and can be a bit of a pin to get working if you never used gettext > before. > > In php youll have functions like gettext() and dgettext() to do the > > translation, for smarty, you can make a function or compiler function > that > > uses gettext. If you use a compiler function, translation will be dnoe > att > > compile time and you must use your language identifier as a part of the > > compile key. > > Ok, I'm starting to actually implement this here. But I have some > questions. > > How do you actually compile the catalog files? Since the templates won't > have > _("foo") patterns in them how do you get gettext to recognize > {translate}foo{/translate} blocks. > > Also, don't you find it cumbersome having to write out {translate} tags > all > the time? Even when I do {_}foo{/_} or {_ text="foo"} I still find it too > cumbersoem. > > I'm thinking of creating a prefilter to transform [[foo]] to the > translated > version of "foo". This would be even better than a compiler function > because > then i wouldn't have constructs like <% echo "foo" %> strewn through the > compiled templates. Instead I would just have "foo" and "fooé" in the > compiled > templates themselves. > > But then how do I get gettext to find all the [[..]] escapes, especially > when > they span lines? > > And ideally I would prefer to use just [..] but I can't because prefilters > are > run before removing {literal} and {php} blocks and they include the smarty > tags, so I would have to check for them which would be a pain. > > I think it would be useful if there was another kind of filter, say, > contentfilters that only got called on the non-{literal} non-{php} and > non-smarty-tag content. > > -- > greg > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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