Important bug in lang.php fixed

Re: Important bug in lang.php fixed

by David Mudrák -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
I have just realized that this new "orphans" feature allows quite a new thing. A friend of mine sent me some of his old 1.6 translated string files (*.php). How to merge them into the current pack? So easy!
  1. I updated my language pack from CVS
  2. I made a backup of current version of the sent string files into the /tmp/backup
  3. I copied sent files and overwrote the current ones
  4. I copied the the current files back from /tmp/backup into the language pack directory - BUT I did not overwrite them. I chose append when asked by file manager. Thus those sent files looked like:

    <?PHP // $Id created with old 1.6 month ago$
    $string['blahblah'] = 'My friend's version';
    $string['wasmissing'] = 'This was missing in the HEAD';

    $string['only16string'] = 'This is not in HEAD 1.8 any more';
    ?>
    <?PHP // $Id created with HEAD 1.8 week ago$
    $string['blahblah'] = 'My own version';
    ?>

  5. When re-saved in lang.php, the file gets merged as wanted (because the $string is an array, the later defined strings win):

    <?PHP // $Id created with HEAD 1.8 today$
    $string['blahblah'] = 'My own version';
    $string['wasmissing'] = 'This was missing in the HEAD';
    $string['only16string'] = 'This is not in HEAD 1.8 any more'; // ORPHANED
    ?>

Thus me as a language pack coordinator can easily merge translated pieces of strings sent by volunteers - even these pieces were translated using older version. No strings should get lost smile