Re: 'lang' file editor ...

From: Date: Thu, 12 Apr 2007 05:57:14 +0000
Subject: Re: 'lang' file editor ...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-252701@lists.php.net to get a copy of this message
Richard Lynch wrote:
Seems to me you'd be better off just running the PHP code and dumping the arrays out with var_dump or print_r "like" function to generate your new language files... Otherwise, you're writing a fairly big chunk of the PHP parser, which is already in PHP, so you re-invent the wheel... On Wed, April 11, 2007 9:07 pm, Jochem Maas wrote:
anyone know of a decent script (or something I can rip out of an existing OS tool) that is capable of comparing, editing and saving 'old skool' lang files - you know the ones which define tons of array elements e.g.: $Lang['foo'] = 'bar'; I'm looking for something that can handle quotes properly and 'weird' array keys (that include constants, for instance) as well as sprintf markers in the 'translation' text (e.g. "my %s hurts") and if at all possible the abiltiy to recognise and not f'up stuff like: $Lang['foo'] = 'my '.$Lang['bar'].' really hurts'; and I'd prefer it to be able to keep file formatting, item ordering and comments as they were when saving back into the file. I can't find anything really useful - the firefox 'php lang file' editor plugin, is, for instance, not up to the job. tar, Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
From what he said, I read that he want to rip the contents out of the file, not actually parse it.
for example, if he parsed this out: $Lang['foo'] = 'my '.$Lang['bar'].' really hurts'; You would get the completed string, not a line that has the variable call in it. Maybe I took it wrong, but that is what I thought he wanted. a reader, not a parser.

« previous php.general (#252701) next »