Ticket #133: issue133.patch
| File issue133.patch, 3.9 KB (added by molnarm, 2 years ago) |
|---|
-
gp-templates/helper-functions.php
5 5 return $text; 6 6 } 7 7 8 function textareas( $entry, $permissions, $index = 0 ) {8 function textareas( $entry, $permissions, $index = 0 , $google_translate=false) { 9 9 list( $can_edit, $can_approve ) = $permissions; 10 10 $disabled = $can_edit? '' : 'disabled="disabled"'; 11 11 ?> … … 28 28 <?php if ( $can_edit ): ?> 29 29 <p> 30 30 <a href="#" class="copy" tabindex="-1"><?php _e('Copy from original'); ?></a> • 31 <a href="#" class="gtranslate" tabindex="-1"><?php _e('Translation from Google'); ?></a> 31 <?php if($google_translate):?> 32 <a href="#" class="gtranslate" tabindex="-1"><?php _e('Translate via Google'); ?></a> 33 <?php else: 34 _e('(Google Translate is not available for this language.)'); 35 endif; ?> 32 36 </p> 33 37 <?php else: ?> 34 38 <p> -
gp-templates/translation-row.php
54 54 <div class="strings"> 55 55 <?php if ( !$t->plural ): ?> 56 56 <p class="original"><?php echo prepare_original( esc_translation($t->singular) ); ?></p> 57 <?php textareas( $t, array( $can_edit, $can_approve )); ?>57 <?php textareas( $t, array( $can_edit, $can_approve), 0, $google_translate ); ?> 58 58 <?php else: ?> 59 59 <?php if ( $locale->nplurals == 2 && $locale->plural_expression == 'n != 1'): ?> 60 60 <p><?php printf(__('Singular: %s'), '<span class="original">'.esc_translation($t->singular).'</span>'); ?></p> 61 <?php textareas( $t, array( $can_edit, $can_approve ), 0 ); ?>61 <?php textareas( $t, array( $can_edit, $can_approve ), 0, $google_translate ); ?> 62 62 <p class="clear"> 63 63 <?php printf(__('Plural: %s'), '<span class="original">'.esc_translation($t->plural).'</span>'); ?> 64 64 </p> 65 <?php textareas( $t, array( $can_edit, $can_approve ), 1 ); ?>65 <?php textareas( $t, array( $can_edit, $can_approve ), 1, $google_translate ); ?> 66 66 <?php else: ?> 67 67 <!-- 68 68 TODO: labels for each plural textarea and a sample number … … 76 76 <p class="plural-numbers"><?php printf(__('This plural form is used for numbers like: %s'), 77 77 '<span class="numbers">'.implode(', ', $locale->numbers_for_index( $plural_index ) ).'</span>' ); ?></p> 78 78 <?php endif; ?> 79 <?php textareas( $t, array( $can_edit, $can_approve ), $plural_index ); ?>79 <?php textareas( $t, array( $can_edit, $can_approve ), $plural_index, $google_translate ); ?> 80 80 <?php endforeach; ?> 81 81 <?php endif; ?> 82 82 <?php endif; ?> -
gp-templates/translations.php
9 9 // localizer adds var in front of the variable name, so we can't use $gp.editor.options 10 10 $editor_options = compact('can_approve', 'can_write', 'url', 'discard_warning_url', 'set_priority_url', 'set_status_url'); 11 11 $editor_options['google_translate_language'] = $locale->google_code; 12 $google_translate=isset($locale->google_code); 12 13 wp_localize_script( 'editor', '$gp_editor_options', $editor_options ); 13 14 wp_localize_script( 'translations-page', '$gp_translations_options', array('action' => $bulk_action) ); 14 15 $parity = gp_parity_factory(); … … 131 132 </dd> 132 133 <dd class="separator"></dd> 133 134 <dd> 135 <?php if($google_translate):?> 134 136 <input type="submit" value="<?php echo esc_attr(__('Translate via Google')); ?>" name="gtranslate" /> 137 <?php else: 138 _e('(Google Translate is not available for this language.)'); 139 endif; ?> 135 140 </dd> 136 141 <dd style="clear: both;"> 137 142 <p class="ternary"><?php _e('<strong>Note:</strong> Bulk edit works only on the current page.'); ?></p>
