Merge pull request #135 from gmorel/french_translation

Translation : Ordering existing translations by keys
This commit is contained in:
Manuel Raynaud
2013-12-09 03:22:07 -08:00

View File

@@ -240,20 +240,18 @@ class TemplateHelper
fwrite($fp, '<' . "?php\n\n");
fwrite($fp, "return array(\n");
$idx = 0;
// Sort keys alphabetically while keeping index
asort($texts);
foreach($texts as $text)
{
foreach ($texts as $key => $text) {
// Write only defined (not empty) translations
if (! empty($translations[$idx])) {
if (! empty($translations[$key])) {
$text = str_replace("'", "\'", $text);
$translation = str_replace("'", "\'", $translations[$idx]);
$translation = str_replace("'", "\'", $translations[$key]);
fwrite($fp, sprintf("\t'%s' => '%s',\n", $text, $translation));
}
$idx++;
}
fwrite($fp, ");\n");