[wp-hackers] Automatic textdomain append for plugins
Nikolay Bachiyski
nbachiyski at developer.bg
Tue Mar 11 08:52:38 GMT 2008
2008/3/11, Jacob Santos <wordpress at santosj.name>:
> Nikolay Bachiyski wrote:
> > Although I am a strong i18n advocate, plugin internationalization[0]
> > has always driven me back, because I had to add textdomain to every
> > gettext call.
> >
> > Developers, they say, are lazy, so I thought of a way not to do this
> > any more. The result was the add-textdomain.php script:
> >
> > php add-textdomain.php shareadraft.php shareadraft
> >
> > This call adds 'shareadraft' as a last argument to all gettext calls
> > in shareadraft.php and prints the modified php file on standard
> > output. It makes sure it doesn't add the argument twice, so it is good
> > for incremental usage.
> >
> > The script is available in the wordpress0i18n repo:
> >
> > http://svn.automattic.com/wordpress-i18n/tools/trunk/add-textdomain.php
> >
> > Happy hacking,
> > Nikolay.
> >
> > [0] http://codex.wordpress.org/Writing_a_Plugin#Internationalizing_Your_Plugin
>
>
> Regex would have been faster and less prone to bugs. However, in all
> fairness, I've yet to have a problem with tokenizing functions. It is
> just classes which give me problems.
Parsing PHP code using regular expressions is the same as parsing XML
using regular expressions -- a matter of preference. In this case the
tokenzier worked better for me and took me much less time to write.
Happy hacking,
Nikolay.
More information about the wp-hackers
mailing list