diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-07-02 11:12:36 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-07-02 11:12:36 +0100 |
| commit | 33d25472d3450462f629468f2bc46c3dac01623d (patch) | |
| tree | f51c687bbcdc086f44c5c390856c810af4493a73 /vendor/fisharebest | |
| parent | e6a4376904b85e5b2599c55477c1403313efa232 (diff) | |
| download | webtrees-33d25472d3450462f629468f2bc46c3dac01623d.tar.gz webtrees-33d25472d3450462f629468f2bc46c3dac01623d.tar.bz2 webtrees-33d25472d3450462f629468f2bc46c3dac01623d.zip | |
Fix: #2476 - text containing special characters is not translated
Diffstat (limited to 'vendor/fisharebest')
| -rw-r--r-- | vendor/fisharebest/localization/CHANGELOG.md | 3 | ||||
| -rw-r--r-- | vendor/fisharebest/localization/src/Translation.php | 21 |
2 files changed, 24 insertions, 0 deletions
diff --git a/vendor/fisharebest/localization/CHANGELOG.md b/vendor/fisharebest/localization/CHANGELOG.md index eedf074b30..a447170b0b 100644 --- a/vendor/fisharebest/localization/CHANGELOG.md +++ b/vendor/fisharebest/localization/CHANGELOG.md @@ -1,6 +1,9 @@ CHANGE LOG ========== +## 1.15.1 (2019-07-02) + - Fix: escaped characters in PO files. + ## 1.15.0 (2019-06-22) - Improve language negotiation for Chinese - Add support for PO files. diff --git a/vendor/fisharebest/localization/src/Translation.php b/vendor/fisharebest/localization/src/Translation.php index 8d76261b4e..5ae721a6cf 100644 --- a/vendor/fisharebest/localization/src/Translation.php +++ b/vendor/fisharebest/localization/src/Translation.php @@ -172,6 +172,7 @@ class Translation $fragments = explode(' ', $part, 2); $keyword = $fragments[0]; $text = substr($fragments[1], 1, -1); + $text = $this->unescapePoText($text); switch ($keyword) { case 'msgctxt': $msgctxt = $text; @@ -207,4 +208,24 @@ class Translation } } } + + /** + * @param string $text + * + * @return string + */ + private function unescapePoText($text) + { + return strtr($text, array( + '\\\\' => '\\', + '\\a' => "\x07", + '\\b' => "\x08", + '\\f' => "\x0c", + '\\n' => "\n", + '\\r' => "\r", + '\\t' => "\t", + '\\v' => "\x0b", + '\\"' => '"', + )); + } } |
