mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
3f7e2f536f
commit
36275129d7
1 changed files with 3 additions and 1 deletions
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue