Skip to content
Permalink
Browse files

Minor code improvements

  • Loading branch information...
burzum committed Dec 5, 2017
1 parent cd19ea7 commit 0620c529d0657fe66d647cb7c062a856a70f60cb
Showing with 11 additions and 12 deletions.
  1. +4 −5 src/I18n/Parser/PoFileParser.php
  2. +7 −7 tests/TestCase/I18n/Parser/PoFileParserTest.php
@@ -14,6 +14,8 @@
*/
namespace Cake\I18n\Parser;
use Cake\I18n\Translator;
/**
* Parses file in PO format
*
@@ -23,9 +25,6 @@
*/
class PoFileParser
{
const PLURAL_PREFIX = 'p:';
/**
* Parses portable object (PO) format.
*
@@ -168,9 +167,9 @@ protected function _addMessage(array &$messages, array $item)
$key = stripcslashes($item['ids']['plural']);
if ($context !== null) {
$messages[static::PLURAL_PREFIX . $key]['_context'][$context] = $plurals;
$messages[Translator::PLURAL_PREFIX . $key]['_context'][$context] = $plurals;
} else {
$messages[static::PLURAL_PREFIX . $key]['_context'][''] = $plurals;
$messages[Translator::PLURAL_PREFIX . $key]['_context'][''] = $plurals;
}
}
}
@@ -77,8 +77,8 @@ public function testParse()
'p:%d = 0 or > 1' => [
'_context' => [
'Another Context' => [
(int)0 => '%d = 1 (translated)',
(int)1 => '%d = 0 or > 1 (translated)'
0 => '%d = 1 (translated)',
1 => '%d = 0 or > 1 (translated)'
]
]
],
@@ -90,11 +90,11 @@ public function testParse()
'p:%-5d = 0 or > 1' => [
'_context' => [
'' => [
(int)0 => '%-5d = 1 (translated)',
(int)1 => '',
(int)2 => '',
(int)3 => '',
(int)4 => '%-5d = 0 or > 1 (translated)'
0 => '%-5d = 1 (translated)',
1 => '',
2 => '',
3 => '',
4 => '%-5d = 0 or > 1 (translated)'
]
]
]

0 comments on commit 0620c52

Please sign in to comment.
You can’t perform that action at this time.