Hi,
forgive me if I ask something which had already been discussed, but I've seen nothing in the archives.

I try to help translating some of the docs and saw here https://edit.php.net/ this box:

Check for errors in /language-snippets.ent

The content for that box seems to get computed from tha class
http://svn.php.net/repository/web/doc-editor/trunk/php/ToolsError.php

There is a method attributLinkTag()

To compare the linkend atrribute of the <link> tags it uses a regex.

$reg = '/<link\s*?linkend=("|\')(.*?)("|\')\s*?>/s';

You see between <link and the linkend attribute only whitespace is allowed. But for example in the german translation (and also in the english documentation) some <link> tags have another attribute between the element name and "linkend".

An easy fix would be
$reg = '/<link[^<>]+linkend=("|\')(.*?)("|\')[^<>]*>/s';

But that would solve only have of the problem; the other problem is that the check script needs the same order of entities in both files and it compares only the position of the found links in both match arrays. So e.g. one link more in the translation will give false matches for all following entries.

Does it make sense to rewrite that algorithm, so that it compares each entity in the english original and the translation so we get better errors?

  KP


Reply via email to