Make WordPress Core

Changeset 35686


Ignore:
Timestamp:
11/18/2015 08:36:50 PM (9 years ago)
Author:
SergeyBiryukov
Message:

I18N: After [35620], move the code for standardizing on \n line endings to Translation_Entry::key().

Props dd32.
Fixes #22172.

Location:
trunk/src/wp-includes/pomo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pomo/entry.php

    r34348 r35686  
    7070    function key() {
    7171        if (is_null($this->singular)) return false;
    72         // prepend context and EOT, like in MO files
    73         return is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
     72
     73        // Prepend context and EOT, like in MO files
     74        $key = is_null($this->context)? $this->singular : $this->context.chr(4).$this->singular;
     75        // Standardize on \n line endings
     76        $key = str_replace( array( "\r\n", "\r" ), "\n", $key );
     77
     78        return $key;
    7479    }
    7580
  • trunk/src/wp-includes/pomo/translations.php

    r35620 r35686  
    8383    function translate_entry(&$entry) {
    8484        $key = $entry->key();
    85         $key = str_replace( "\r\n", "\n", $key );
    8685        return isset($this->entries[$key])? $this->entries[$key] : false;
    8786    }
Note: See TracChangeset for help on using the changeset viewer.