diff --git a/src/Generator/MoGenerator.php b/src/Generator/MoGenerator.php index 5edb68e..e815101 100644 --- a/src/Generator/MoGenerator.php +++ b/src/Generator/MoGenerator.php @@ -45,7 +45,7 @@ public function generateString(Translations $translations): string $messages[$originalString] = $translation; } - ksort($messages); + ksort($messages, SORT_STRING); $numEntries = count($messages); $originalsTable = ''; $translationsTable = ''; diff --git a/tests/MoGeneratorTest.php b/tests/MoGeneratorTest.php index 06b3f5d..a3e246d 100644 --- a/tests/MoGeneratorTest.php +++ b/tests/MoGeneratorTest.php @@ -36,6 +36,10 @@ public function testMoGenerator() $translation->translate('Comentario deshabilitado'); $translations->add($translation); + $translation = Translation::create(null, '15'); + $translation->translate('15'); + $translations->add($translation); + $translation = Translation::create(null, '123456'); $translation->translate('12345'); $translations->add($translation); @@ -47,7 +51,7 @@ public function testMoGenerator() $result = $loader->loadString($mo); - $this->assertCount(3, $result); + $this->assertCount(4, $result); $this->assertCount(5, $result->getHeaders()); } } diff --git a/tests/assets/mo-generator-result.mo b/tests/assets/mo-generator-result.mo index cc7feb7..b717abe 100644 Binary files a/tests/assets/mo-generator-result.mo and b/tests/assets/mo-generator-result.mo differ