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.
This commit is contained in:
Rachman Chavik 2012-04-10 08:58:20 +07:00
parent 3f7e2f536f
commit 36275129d7

View file

@ -463,6 +463,8 @@ class ExtractTask extends AppShell {
* @return void
*/
protected function _buildFiles() {
$paths = $this->_paths;
$paths[] = realpath(APP) . DS;
foreach ($this->_translations as $domain => $translations) {
foreach ($translations as $msgid => $details) {
$plural = $details['msgid_plural'];
@ -473,7 +475,7 @@ class ExtractTask extends AppShell {
$occurrences[] = $file . ':' . implode(';', $lines);
}
$occurrences = implode("\n#: ", $occurrences);
$header = '#: ' . str_replace($this->_paths, '', $occurrences) . "\n";
$header = '#: ' . str_replace($paths, '', $occurrences) . "\n";
if ($plural === false) {
$sentence = "msgid \"{$msgid}\"\n";