Permalink
Browse files

Fixing an small error with token parsing, tests added. Refs #333.

  • Loading branch information...
1 parent f6f04b6 commit 5653c720f08a830ab6df5b8f1e721846ef2740df @renan renan committed Feb 12, 2010
@@ -264,7 +264,7 @@ function __parse($functionName, $map) {
$count = 0;
$tokenCount = count($this->__tokens);
- while (($tokenCount - $count) > 7) {
+ while (($tokenCount - $count) > 1) {
list($countToken, $firstParenthesis) = array($this->__tokens[$count], $this->__tokens[$count + 1]);
if (!is_array($countToken)) {
$count++;
@@ -321,12 +321,12 @@ function __parse($functionName, $map) {
function __buildFiles() {
foreach ($this->__strings as $domain => $strings) {
foreach ($strings as $string => $files) {
- $occurances = array();
+ $occurences = array();
foreach ($files as $file => $lines) {
- $occurances[] = $file . ':' . implode(';', $lines);
+ $occurences[] = $file . ':' . implode(';', $lines);
}
- $occurances = implode("\n#: ", $occurances);
- $header = '#: ' . str_replace($this->__paths, '', $occurances) . "\n";
+ $occurences = implode("\n#: ", $occurences);
+ $header = '#: ' . str_replace($this->__paths, '', $occurences) . "\n";
if (strpos($string, "\0") === false) {
$sentence = "msgid \"{$string}\"\n";
@@ -126,9 +126,17 @@ function testExecute() {
$this->assertPattern($pattern, $result);
// extract.ctp
- $pattern = '/msgid "You have %d new message."\nmsgid_plural "You have %d new messages."/';
+ $pattern = '/\#: (\\\\|\/)extract\.ctp:6\n';
+ $pattern .= 'msgid "You have %d new message."\nmsgid_plural "You have %d new messages."/';
$this->assertPattern($pattern, $result);
- $pattern = '/msgid "You deleted %d message."\nmsgid_plural "You deleted %d messages."/';
+
+ $pattern = '/\#: (\\\\|\/)extract\.ctp:7\n';
+ $pattern .= 'msgid "You deleted %d message."\nmsgid_plural "You deleted %d messages."/';
+ $this->assertPattern($pattern, $result);
+
+ $pattern = '/\#: (\\\\|\/)extract\.ctp:14\n';
+ $pattern .= '\#: (\\\\|\/)home\.ctp:74\n';
+ $pattern .= 'msgid "Editing this Page"\nmsgstr ""/';
$this->assertPattern($pattern, $result);
// extract.ctp - reading the domain.pot
@@ -144,7 +152,6 @@ function testExecute() {
$pattern = '/msgid "You deleted %d message \(domain\)."\nmsgid_plural "You deleted %d messages \(domain\)."/';
$this->assertPattern($pattern, $result);
-
$Folder = new Folder($path);
$Folder->delete();
}
@@ -1,11 +1,14 @@
<?php
$count = 10;
-$message = array('count' => 10);
+$messages = array('count' => 10);
// Plural
__n('You have %d new message.', 'You have %d new messages.', $count);
__n('You deleted %d message.', 'You deleted %d messages.', $messages['count']);
// Domain Plural
__dn('domain', 'You have %d new message (domain).', 'You have %d new messages (domain).', '10');
-__dn('domain', 'You deleted %d message (domain).', 'You deleted %d messages (domain).', $messages['count']);
+__dn('domain', 'You deleted %d message (domain).', 'You deleted %d messages (domain).', $messages['count']);
+
+// Duplicated Message
+__('Editing this Page');

0 comments on commit 5653c72

Please sign in to comment.