Make WordPress Core

Ticket #26638: l10n-false.patch

File l10n-false.patch, 1.2 KB (added by dshafik, 11 years ago)
  • wp-includes/l10n.php

     
    7272 */
    7373function translate( $text, $domain = 'default' ) {
    7474        $translations = get_translations_for_domain( $domain );
     75
     76        if ($translations == false) {
     77                return apply_filters( 'gettext', $text, $text, $domain );
     78        }
     79
     80        var_dump($translations);
     81
    7582        $translations = $translations->translate( $text );
    7683        /**
    7784         * Filter text with its translation.
     
    119126 */
    120127function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
    121128        $translations = get_translations_for_domain( $domain );
    122         $translations = $translations->translate( $text, $context );
     129
     130        if ($translations === false) {
     131                $translations = $text;
     132        } else {
     133                $translations = $translations->translate( $text, $context );
     134        }
    123135        /**
    124136         * Filter text with its translation based on context information.
    125137         *
     
    675687function get_translations_for_domain( $domain ) {
    676688        global $l10n;
    677689        if ( !isset( $l10n[$domain] ) ) {
    678                 $l10n[$domain] = new NOOP_Translations;
     690                $l10n[$domain] = false;
    679691        }
    680692        return $l10n[$domain];
    681693}