From 28a1b19ed1876c2dd533c208f3e7e92d2aca98ef Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 18 Nov 2015 20:36:50 +0000 Subject: [PATCH] I18N: After [35620], move the code for standardizing on `\n` line endings to `Translation_Entry::key()`. Props dd32. Fixes #22172. git-svn-id: https://develop.svn.wordpress.org/trunk@35686 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/pomo/entry.php | 9 +++++++-- src/wp-includes/pomo/translations.php | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/pomo/entry.php b/src/wp-includes/pomo/entry.php index 67f6719b2b..3e4bc3bdd5 100644 --- a/src/wp-includes/pomo/entry.php +++ b/src/wp-includes/pomo/entry.php @@ -69,8 +69,13 @@ class Translation_Entry { */ function key() { if (is_null($this->singular)) return false; - // prepend context and EOT, like in MO files - return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular; + + // Prepend context and EOT, like in MO files + $key = is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular; + // Standardize on \n line endings + $key = str_replace( array( "\r\n", "\r" ), "\n", $key ); + + return $key; } /** diff --git a/src/wp-includes/pomo/translations.php b/src/wp-includes/pomo/translations.php index aaf9a35550..6008f4aa18 100644 --- a/src/wp-includes/pomo/translations.php +++ b/src/wp-includes/pomo/translations.php @@ -82,7 +82,6 @@ class Translations { */ function translate_entry(&$entry) { $key = $entry->key(); - $key = str_replace( "\r\n", "\n", $key ); return isset($this->entries[$key])? $this->entries[$key] : false; }