Making WordPress.org

Changeset 6500


Ignore:
Timestamp:
02/01/2018 07:03:07 AM (6 years ago)
Author:
dd32
Message:

GlotPress Translation Bridge: When we can't find a translation, and the source text contains encoded entities, attempt to find the text unencoded.

Fixes #1628.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/glotpress-translate-bridge/glotpress-translate-bridge.php

    r2305 r6500  
    127127        $sql_singular = isset( $strings['singular'] ) ? $wpdb->prepare( "o.singular = %s", $strings['singular'] ) : 'o.singular IS NULL';
    128128        $sql_plural   = isset( $strings['plural'] )   ? $wpdb->prepare( "o.plural = %s",   $strings['plural']   ) : 'o.plural IS NULL';
    129         $sql_context  = isset( $strings['context'] )  ? $wpdb->prepare( "o.contxt = %s",   $strings['context']  ) : 'o.context IS NULL';
     129        $sql_context  = !empty( $strings['context'] ) ? $wpdb->prepare( "o.context = %s",  $strings['context']  ) : 'o.context IS NULL';
    130130
    131131        $sql_locale = $wpdb->prepare( "s.locale = %s AND s.slug = %s", $locale['locale'], $locale['slug'] );
     
    148148        );
    149149
     150        if ( ! $translation ) {
     151            $decoded_strings = array_map( 'html_entity_decode', $strings );
     152            if ( $decoded_strings != $strings ) {
     153                $translation = $this->find_translation( $decoded_strings, $project_path );
     154            }
     155        }
     156
    150157        if ( $translation ) {
    151158            $translation = array_filter( $translation );
Note: See TracChangeset for help on using the changeset viewer.