Skip to content
This repository
Browse code

i18n: consider real path of APP to handle symlinks

When extracting model validation messages, Reflection::getFileName is used
to obtain the the model filename. The returned value is actual physical
path and may differ to what APP is. Adding the realpath(APP) to $paths
variable allows str_replace() to correctly generate the correct value for
$occurences.
  • Loading branch information...
commit 36275129d710ea385ad5cb611feda6b75e84e4d9 1 parent 3f7e2f5
Rachman Chavik authored
4  lib/Cake/Console/Command/Task/ExtractTask.php
@@ -463,6 +463,8 @@ protected function _processValidationRules($field, $rules, $file, $domain) {
463 463
  * @return void
464 464
  */
465 465
 	protected function _buildFiles() {
  466
+		$paths = $this->_paths;
  467
+		$paths[] = realpath(APP) . DS;
466 468
 		foreach ($this->_translations as $domain => $translations) {
467 469
 			foreach ($translations as $msgid => $details) {
468 470
 				$plural = $details['msgid_plural'];
@@ -473,7 +475,7 @@ protected function _buildFiles() {
473 475
 					$occurrences[] = $file . ':' . implode(';', $lines);
474 476
 				}
475 477
 				$occurrences = implode("\n#: ", $occurrences);
476  
-				$header = '#: ' . str_replace($this->_paths, '', $occurrences) . "\n";
  478
+				$header = '#: ' . str_replace($paths, '', $occurrences) . "\n";
477 479
 
478 480
 				if ($plural === false) {
479 481
 					$sentence = "msgid \"{$msgid}\"\n";

0 notes on commit 3627512

Please sign in to comment.
Something went wrong with that request. Please try again.