[Phpmyadmin-devel] advisory rules and translation

Tyron Madlener tyronx at gmail.com
Mon Aug 8 10:47:20 CEST 2011


On Mon, Aug 8, 2011 at 10:34 AM, Michal Čihař <michal at cihar.com> wrote:
> Hi
>
> Dne Sat, 6 Aug 2011 21:49:56 +0300
> Tyron Madlener <tyronx at gmail.com> napsal(a):
>
>> Yes, that is an issue that I still have to solve. I'd love to keep the
>> rules file independent from the translation mechanism by adding some
>> compile/transform mechanism for pma releases.
>>
>> But if that is not possible I guess I will have to rename
>> advisory_rules.txt to a php file, surround all text strings with __('
>> '); and hope it works as well.
>>
>> I'd prefer to have the syntax of advsiory_rules.txt as simple as
>> possible so other users can easily add new rules without the knowledge
>> of php.
>
> What I don't like about text file solution is that it brings need to
> maintain parser for that. Having the data as PHP array would avoid this
> and I think it could be as readable as the text file is. I would see
> great advantage of text file if it could be shared with other tools,
> what I don't think it is the case right now. Being only for phpMyAdmin,
> I'd stick with PHP code.
>
> On the other side, translation could be solved for text file as well,
> if we decide to use it.

Some arguments for a independent file formatted are narrated by a
comment from Sheeri here:
https://answers.launchpad.net/mysqltuner/+question/166442

> I would see great advantage of text file if it could be shared with other tools, what I don't think it is the case right now.

Indeed, I chose the format this way, in the hope for it to be used
with other tools as well. Maybe I am being a bit too visionary there.
However, quite naturally, a new file format will be used by only one
tool in the beginning ;-)
It is also possible to build the rules file more independent (e.g.
remove preg_match() calls), to guarantee the interchangeability.

> I agree with Piotr. Also, having this rule parser in the code base means
more code to maintain.

The rule parser itself is only around 80 lines of code. For php arrays
it would also require some lines of code to verify if the elements in
the array are in the correct format.

Unfortunately it is hard to estimate the gain and loss when using php
arrays instead of a (mostly) independent syntax, since we don't know
how this will develop in the future.

If translation of the text file is possible with not too much efforts,
I still would vote for that solution.
However, if I am the only one with that opinion I will bend to the
opinion of the majority ;-)

>
> --
>        Michal Čihař | http://cihar.com | http://blog.cihar.com
>




More information about the Developers mailing list