what I'm looking for is something that will make it possible for an end user to merge [the contents] existing language files (that contain the items for the same language) *and* perform translations between languages in a visual/easy way (i.e. without opening a text editor) but end up with lang files that still formatted and commented when I'm done. it's a three step process: 1. 'parse' 2 files: a 'reference' and a 'translation' file 2. display an editing interface for the 2 files (textareas, filtering [e.g. show only untranslated items], sorting, etc) 3. write out a merged/updated file. probably the merging of 2 existing lang files of the same language will require a seperate interface than the translation/comparison of 2 files containing different languages. I have made a half-assed attempt to do this some years ago and it worked ok but wasn't quite the level of sophistication I desired - If no one has anything like this lying around then I guess it's time for me to hack up a new thingummy, using var_export()/print_r() [and running the code to merge, etc] won't cut it (I've been down that road already) so probably I'm looking at using either the tokenizer (although how exactly is something I'd have to look into) or a combination of preg_match()/preg_replace() (which is something I am confident I can now do to the required level - when I tried before my regexp skills sucked too much). I'm quite sure I make it work, but I'd be surprised if no-one has gone before me - there must be tons of projects out there with the same kind of language file structure ... maybe I should consider moving my 'shit' into gettext format. Jim Lucas wrote: > 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. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php