[TxMt] Parse entire project with regex
Constantinos Neophytou ♎
constantinos at neophytou.net
Sun Sep 9 15:13:38 UTC 2007
I have a question that I'm sure has a simple solution, and if my
brain worked properly these days I'd be able to find it either online
or somewhere in the archives... But I can't, so here goes...
I need to parse an entire project through a regex, and produce some
formatted output. The regex is quite simple, and the reason is to
create a 'translation' file. I have a huge project where I've used
the wordpress-style convention (which in turn is based on the gettext
style convention) of translating strings, namely passing them to the
__() function (this is all in php). I'm not using gettext, i've just
wrapped my own code around that function (which is why i'm using __()
instead of _() )
This function at the moment simply returns the input as output (since
all the text strings are in english, and I haven't really translated
anything yet so my translation files are empty). What I want is to
parse all of my code for /__\(['"](.*)['"]\)/ and some variations
thereof, and produce a line-separated list of strings that need to be
translated. I'd like to make this an automated process, because this
is an ongoing project and i'd like to refresh the to-be-translated
strings file frequently.
I believe poedit already does something like this, but attempting to
get my head around .po and .mo files at this point just gave me a
migraine (nb: if someone knows of a good, step-by-step 'for dummies'
tutorial for this stuff, I'd appreciate it).
Any ideas?
Constantinos Neophytou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1263 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070909/3ce4666c/attachment.p7s>
More information about the textmate
mailing list