Skip to content

Commit

Permalink
- Some cleanup
Browse files Browse the repository at this point in the history
- Fix for pattern (multiline)
- Add another ignored strings
- 0.2 on the way :)
  • Loading branch information
Saibamen committed Aug 15, 2015
1 parent d85fdbe commit c0b5c91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$fileExt = 'rc';

// Ignore string list
$ignoreString = array('OK', 'Ok', '&OK', '[OK]\n', 'ReactOS', 'MS Shell Dlg', 'Arial', 'Static', 'STATIC', 'popup', 'http://www.reactos.org', 'DUMMY', 'Tab1', 'List1', 'List2', 'List3', 'Slider1', 'Text1', 'Text2', 'Text3');
$ignoreString = array('OK', 'Ok', '&OK', '[OK]\n', 'ReactOS', 'MS Shell Dlg', 'Arial', 'Static', 'STATIC', 'popup', 'http://www.reactos.org', 'DUMMY', 'Tab1', 'List1', 'List2', 'List3', 'Slider1', 'Text1', 'Text2', 'Text3', '?', '/', '...');

// Maximize the default PHP time limit to 60 seconds
set_time_limit(60);
Expand Down
16 changes: 7 additions & 9 deletions diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function diff_versions($leftContent, $rightContent)
$leftVersion = $rightVersion = null;

// FIXME: Search multi-line with ""some text""
$pattern = "/^(?!FONT|\s*\*)[^\"\\n]*\"\\K(?!\\s+\")([^\"]+)/m";
$pattern = "/^(?!FONT|\\s*\\*)[^\"\\n]*\"\\K(?!\\s*(?:\"|\\n))([^\"]+)/m";

if (preg_match_all($pattern, $leftContent, $matches) <= 0)
{
Expand All @@ -140,7 +140,7 @@ function diff_versions($leftContent, $rightContent)

$regex = new RegexIterator($it, '/^.+'. $langDir .'.+('. $originLang .')\.'. $fileExt .'$/i', RecursiveRegexIterator::GET_MATCH);

$allEnglish = $missingFiles = $missing = $allStrings = 0;
$missing = $allStrings = 0;

$lang = htmlspecialchars($_POST["lang"]);
$fileSearch = strtoupper($lang) .",". ucfirst($lang) .",". strtolower($lang);
Expand All @@ -157,7 +157,6 @@ function diff_versions($leftContent, $rightContent)
if (empty($isFile))
{
echo '<b>No translation</b> for path '. $regex->getPathInfo() .'<hr>';
$missingFiles++;
}
else
{
Expand All @@ -179,20 +178,19 @@ function diff_versions($leftContent, $rightContent)
echo $english ."<br>";
$missing++;
}
$allStrings++;
else
{
$allStrings++;
}
}
echo "<hr>";
}
}
$allEnglish++;
}
$regex->next();
}

echo "<h3>All translation RC files for english: $allEnglish</h3>";
echo "<h3>Missing translation files for your language ($lang): $missingFiles</h3>";
echo "<h3>All strings for english: $allStrings</h3>";
echo "<h3>Missing translations: $missing</h3>";
echo "<h3>Missing translations for your language ($lang): $missing</h3>";
}
}

Expand Down

0 comments on commit c0b5c91

Please sign in to comment.