We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16034
    • 107 Posts
    Hi,

    I made a small script for updating language-files to contain all entries that are in the english files.
    <?
    include("danish.inc.php");
    $dk=$_lang;
    
    unset($_lang);
    include("english.inc.php");
    $en=$_lang;
    unset($_lang);
    echo "<?php\n";
    foreach($en as $key => $value)
    {
    	if (isset($dk[$key])) {
    		echo "\$_lang[\"".$key."\"] = '".str_replace('\'','\\\'',$dk[$key])."';\n";
    	}
    	else {
    		echo "\$_lang[\"".$key."\"] = ''; // English version: '".str_replace('\'','\\\'',$value)."'\n";
    
    	}
    }
    echo "?>";
    ?>


    It copies entries already in the non-english file and creates new empty entries for the non-existant entries. The english text is added as a comment after the empty string.

    It doesn’t care about comments in the language files and hence the header should be added manually afterwards. It there are entries in the non-english file that are not in the english file, they will be lost.

    After running the script you can manually find all the strings by running a simple search for "English version" in your favourite text editor.

    I used this script to update the danish Manager-translation to match the English in 0.9.6.1 and put the result in the wiki: http://wiki.modxcms.com/index.php/Manager_da-dk

    Questions/comments/corrections are very welcome (if it’s regarding the translation I suggest using the scandinavian forum, where I created a topic: http://modxcms.com/forums/index.php/topic,21775.0.html)

    /Kleist
      MODx snippet-glossary 101:
      Ditto = Content Lister -- Wayfinder == Menu Builder -- Jot = Comment Control
      • 22303 MODX Staff
      • 10,725 Posts
      Very nice Kleist; thanks for the contribution. Should come in very handy!
        • 20289
        • 958 Posts
        Thanks a lot Kleist, ...Hnady Script that will save time when there is many new entries in the language file.
        Do you have the time to put this trick in the wiki? :-]
          [img]http://i10.tinypic.com/52c4eir.gif[/img][/td]
          [td][Wiki] [Persian support forum]
          [SVN] [RTL SVN Branch] [bugs] [FishEye+Crucible] [Learn MODx!] | [My Google Code]
          [font=tahoma][برای دسترسی به راهنمای فارسی به [url=http://www.modxcms.ir]
          • 25663 MODX Staff
          • 12,272 Posts
          This should definitely be in the wiki and replace the now-current stuff. Way easier and better, too! Hmm... it’d be really cool to see a little custom web app that shows the English, the existing non-English and blank for any empty ones and at the end asks for the authorship information and spits out a file.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 20289
            • 958 Posts
            Quote from: rthrash at Jan 19, 2008, 12:02 AM

            This should definitely be in the wiki and replace the now-current stuff. Way easier and better, too! Hmm... it’d be really cool to see a little custom web app that shows the English, the existing non-English and blank for any empty ones and at the end asks for the authorship information and spits out a file.
            Cool interesting idea! laugh, looking forward for someone to pick this idea and transfer it to a sensible thing.
              [img]http://i10.tinypic.com/52c4eir.gif[/img][/td]
              [td][Wiki] [Persian support forum]
              [SVN] [RTL SVN Branch] [bugs] [FishEye+Crucible] [Learn MODx!] | [My Google Code]
              [font=tahoma][برای دسترسی به راهنمای فارسی به [url=http://www.modxcms.ir]
              • 16034
              • 107 Posts
              I did consider making this a bit more universal, and perhaps as a module in MODx. But I don’t have the time for it at the moment. You’re welcome to use my small example however you like, including rewriting it, enhancing it, putting it in the wiki etc.
                MODx snippet-glossary 101:
                Ditto = Content Lister -- Wayfinder == Menu Builder -- Jot = Comment Control