Changeset 368

Show
Ignore:
Timestamp:
04/28/08 20:04:34 (2 years ago)
Author:
calh
Message:

don't strip newlines (it makes debugging difficultr). work with my windows version of php (wtf no argv?). die if you can't find the templates folder (since cygwin is being dumb today). print progress as you go

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/uploadr/strings_import.php

    r332 r368  
    44 
    55$locale = dirname(__FILE__) . '/MacUploadr.app/Contents/Resources/chrome/locale'; 
     6 
     7if (count($_GET)){ 
     8        $argv = array_keys($_GET); 
     9        array_unshift($argv, 'foo.php'); 
     10} 
     11 
    612 
    713# Gotta have a source folder for all those other languages 
     
    1319foreach (array('de-de', 'es-us', 'fr-fr', 'it-it', 'ko-kr', 'pt-br', 'zh-hk') as $l) { 
    1420        $dir = opendir("$argv[1]/$l"); 
     21        if (!$dir) die; 
    1522        while (false !== $file = readdir($dir)) { 
    1623 
     
    3239                        continue; 
    3340                } 
    34                 $text = trim(str_replace("\n\n", "\n", preg_replace('/^<\?php.*\?>$/ms', '', $text))); 
     41                $text = trim(preg_replace('/^<\?php.*\?>$/ms', '', $text)); 
    3542 
    3643                # Process each string 
     
    7481                        continue; 
    7582                } 
    76                 if (false === fwrite($file_p, implode("\n", 
    77                         array_diff($lines, array(''))))) { 
     83                if (false === fwrite($file_p, implode("\n", $lines))) { 
    7884                        echo "[error] Writing $file\n"; 
    7985                } 
     
    8288                } 
    8389 
     90                echo "[ok] finished writing $l/$file\n"; 
    8491        } 
    8592        closedir($dir);