↵\n", $text); $text = str_replace( "\t", "→\t", $text); return $text; } function map_glossary_entries_to_translations_originals( $translations, $glossary ) { $glossary_entries = GP::$glossary_entry->by_glossary_id( $glossary->id ); if ( empty ( $glossary_entries ) ) { return $translations; } $glossary_entries_terms = array(); //Create array of glossary terms, longest first foreach ( $glossary_entries as $key => $value ) { $glossary_entries_terms[ $key ] = $value->term; } uasort( $glossary_entries_terms, function( $a, $b ) { return gp_strlen($a) < gp_strlen($b); } ); foreach ( $translations as $key => $t ) { //Save our current singular/plural strings before attempting any markup change. Also escape now, since we're going to add some html. $translations[$key]->singular_glossary_markup = esc_translation( $t->singular ); $translations[$key]->plural_glossary_markup = esc_translation( $t->plural ); //Search for glossary terms in our strings $matching_entries = array(); foreach( $glossary_entries_terms as $i => $term ) { $glossary_entry = $glossary_entries[ $i ]; if ( gp_stripos( $t->singular . ' ' . $t->plural, $term ) !== false ) { $matching_entries[$term][] = array( 'translation' => $glossary_entry->translation, 'pos' => $glossary_entry->part_of_speech, 'comment' => $glossary_entry->comment ); } } //Replace terms in strings with markup foreach( $matching_entries as $term => $glossary_data ) { $replacement = '$1'; $translations[$key]->singular_glossary_markup = preg_replace( '/\b(' . preg_quote( $term, '/' ) . '[es|s]?)(?![^<]*<\/span>)\b/iu', $replacement, $translations[$key]->singular_glossary_markup, 1 ); if ( $t->plural ) { $translations[$key]->plural_glossary_markup = preg_replace( '/\b(' . preg_quote( $term, '/' ) . '[es|s]?)(?![^<]*<\/span>)\b/iu', $replacement, $translations[$key]->plural_glossary_markup, 1 ); } } } return $translations; } function textareas( $entry, $permissions, $index = 0 ) { list( $can_edit, $can_approve ) = $permissions; $disabled = $can_edit? '' : 'disabled="disabled"'; ?>
warnings[$index] ) ): $referenceable = $entry->warnings[$index]; $warning = each( $referenceable ); ?>
Warning: %s'), esc_html( $warning['value'] ) ); ?>
translations, $index ) ); ?>

have to log in to edit this translation.'), gp_url_login() ); ?>

references, $project, $entry ); if ( ! $show_references ) return; ?>