Permalink
Browse files

Merge pull request #914 from dereuromark/2.3-i18n-extract

Normalize paths in generate pot files to always use /

Fixes #3306
  • Loading branch information...
2 parents 02cface + cc43614 commit d051b6931212061965684d7a0da222fa52c82ef4 @markstory markstory committed Oct 26, 2012
@@ -523,7 +523,7 @@ protected function _buildFiles() {
$occurrences[] = $file . ':' . implode(';', $lines);
}
$occurrences = implode("\n#: ", $occurrences);
- $header = '#: ' . str_replace($paths, '', $occurrences) . "\n";
+ $header = '#: ' . str_replace(DS, '/', str_replace($paths, '', $occurrences)) . "\n";
if ($plural === false) {
$sentence = "msgid \"{$msgid}\"\n";
@@ -308,10 +308,10 @@ public function testExtractModelValidation() {
$this->Task->execute();
$result = file_get_contents($this->path . DS . 'default.pot');
- $pattern = preg_quote('#Model' . DS . 'PersisterOne.php:validation for field title#', '\\');
+ $pattern = preg_quote('#Model/PersisterOne.php:validation for field title#', '\\');
$this->assertRegExp($pattern, $result);
- $pattern = preg_quote('#Model' . DS . 'PersisterOne.php:validation for field body#', '\\');
+ $pattern = preg_quote('#Model/PersisterOne.php:validation for field body#', '\\');
$this->assertRegExp($pattern, $result);
$pattern = '#msgid "Post title is required"#';
@@ -354,10 +354,10 @@ public function testExtractModelValidationWithDomainInModel() {
$this->Task->execute();
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
- $pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
+ $pattern = preg_quote('#Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title#', '\\');
$this->assertRegExp($pattern, $result);
- $pattern = preg_quote('#Plugin' . DS . 'TestPlugin' . DS . 'Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
+ $pattern = preg_quote('#Plugin/TestPlugin/Model/TestPluginPost.php:validation for field body#', '\\');
$this->assertRegExp($pattern, $result);
$pattern = '#msgid "Post title is required"#';
@@ -393,10 +393,10 @@ public function testExtractModelValidationInPlugin() {
$this->Task->execute();
$result = file_get_contents($this->path . DS . 'test_plugin.pot');
- $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field title#', '\\');
+ $pattern = preg_quote('#Model/TestPluginPost.php:validation for field title#', '\\');
$this->assertRegExp($pattern, $result);
- $pattern = preg_quote('#Model' . DS . 'TestPluginPost.php:validation for field body#', '\\');
+ $pattern = preg_quote('#Model/TestPluginPost.php:validation for field body#', '\\');
$this->assertRegExp($pattern, $result);
$pattern = '#msgid "Post title is required"#';

0 comments on commit d051b69

Please sign in to comment.