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
This commit is contained in:
Sergey Biryukov 2015-11-18 20:36:50 +00:00
parent 6d01a1266d
commit 28a1b19ed1
2 changed files with 7 additions and 3 deletions

View File

@ -69,8 +69,13 @@ class Translation_Entry {
*/ */
function key() { function key() {
if (is_null($this->singular)) return false; 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;
} }
/** /**

View File

@ -82,7 +82,6 @@ class Translations {
*/ */
function translate_entry(&$entry) { function translate_entry(&$entry) {
$key = $entry->key(); $key = $entry->key();
$key = str_replace( "\r\n", "\n", $key );
return isset($this->entries[$key])? $this->entries[$key] : false; return isset($this->entries[$key])? $this->entries[$key] : false;
} }