Re: 'lang' file editor ...
| From: | Jochem Maas | Date: | Thu, 12 Apr 2007 12:26:19 +0000 |
| Subject: | Re: 'lang' file editor ... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252720@lists.php.net to get a copy of this message | ||
I just played around with token_get_all() and token_name() and by the looks of the
output it's going to be quite easy to create something that can rewrite the contents of a file
and
or augment it ...
the only really tricky thing that I can't get my head round right away is
handling the following in a nice way:
$Lang['foo'] = 'bar';
$Lang['foo'] = 'my '.$Lang['bar'].' really hurts';
but part of the answer/solution to that problem lies in what I would like
to present (and/or require from0 the person who will use the lang file 'editor'
it's been a pleasure talking to myself ;-)
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
>