GettextTranslationHelper: Ensure that file source locations are relative

fixes #2684
This commit is contained in:
Johannes Meyer 2017-01-25 09:56:21 +01:00
parent 2f8d4739b8
commit 91a315764c
1 changed files with 17 additions and 0 deletions

View File

@ -280,6 +280,7 @@ class GettextTranslationHelper
}
}
$this->updateHeader($this->tablePath);
$this->fixSourceLocations($this->tablePath);
}
/**
@ -400,12 +401,28 @@ class GettextTranslationHelper
'"Content-Type: text/plain; charset=' . $headerInfo['charset'] . '\n"',
'"Content-Transfer-Encoding: 8bit\n"',
'"Plural-Forms: nplurals=2; plural=(n != 1);\n"',
'"X-Poedit-Basepath: .\n"',
'"X-Poedit-SearchPath-0: .\n"',
''
)
) . PHP_EOL . substr($content, strpos($content, '#: '))
);
}
/**
* Adjust all absolute source file paths so that they're all relative to the catalog's location
*
* @param string $path
*/
protected function fixSourceLocations($path)
{
shell_exec(sprintf(
"sed -i 's;%s;../../../..;g' %s",
dirname($this->appDir),
$path
));
}
/**
* Create the file catalog
*