Ticket #57: loca.diff
| File loca.diff, 35.0 KB (added by momo360modena, 2 years ago) |
|---|
-
scripts/recheck-warnings.php
10 10 $warnings = GP::$translation_warnings->check( $entry->singular, $entry->plural, $entry->translations, $locale ); 11 11 if ( $warnings != $entry->warnings ) { 12 12 $translation = new GP_Translation( array('id' => $entry->id) ); 13 echo "Updating warnings for $entry->id\n";13 echo sprintf( __("Updating warnings for %s"), $entry->id ) . "\n"; 14 14 $translation->update( array('warnings' => $warnings) ); 15 15 } 16 16 } -
scripts/import-originals.php
12 12 $this->usage(); 13 13 } 14 14 $project = GP::$project->by_path( $this->options['p'] ); 15 if ( !$project ) $this->error( 'Project not found!');15 if ( !$project ) $this->error( __('Project not found!') ); 16 16 17 17 $translations = new PO(); 18 18 $translations->import_from_file( $this->options['f'] ); 19 if ( !$translations ) $this->error( 'Error importing from POT file!');19 if ( !$translations ) $this->error( __('Error importing from POT file!') ); 20 20 21 21 GP::$original->import_for_project( $project, $translations ); 22 22 } -
gp-templates/footer.php
1 1 <p id="footer"class="secondary"> 2 Proudly powered by <a href="http://glotpress.org/" title="Found in translation">GlotPress</a>.3 <?php gp_footer(); ?> 2 <?php printf( __('Proudly powered by <a href="%s" title="Found in translation">GlotPress</a>.'), 'http://glotpress.org/' ); ?> 3 <?php gp_footer(); ?> 4 4 </p> 5 5 </body> 6 6 </html> 7 No newline at end of file -
gp-templates/translation-set-permissions.php
4 4 gp_link_project_get( $project, $project->name ), 5 5 $locale->english_name, 6 6 'default' != $translation_set->slug? $translation_set->name : '', 7 'Permissions'7 __('Permissions') 8 8 ) ); 9 9 gp_tmpl_header(); 10 10 ?> 11 <h2> Permissions</h2>11 <h2><?php _e('Permissions'); ?></h2> 12 12 <ul id="translation-set-permissions"> 13 <? foreach( $permissions as $permission ): ?> 14 <li> 15 <span class="permission-action">user</span> 16 <span class="user"><?php echo esc_html( $permission->user->user_login ); ?></span> 17 <span class="permission-action">can <?php echo esc_html( $permission->action ); ?></span> 18 <a href="<?php echo gp_url_join( gp_url_current(), '_delete/'.$permission->id ); ?>" class="action delete">Remove</a> 19 </li> 20 <? endforeach; ?> 21 <?php if ( !$permissions ): ?> 22 <strong>No validators defined for this translation set.</strong> 23 <?php endif; ?> 13 <?php foreach( $permissions as $permission ): ?> 14 <li> 15 <span class="permission-action"><?php _e('user'); ?></span> 16 <span class="user"><?php echo esc_html( $permission->user->user_login ); ?></span> 17 <span class="permission-action">can <?php echo esc_html( $permission->action ); ?></span> 18 <a href="<?php echo gp_url_join( gp_url_current(), '_delete/'.$permission->id ); ?>" class="action delete"><?php _e('Remove'); ?></a> 19 </li> 20 <? endforeach; ?> 21 22 <?php if ( !$permissions ): ?> 23 <strong><?php _e('No validators defined for this translation set.'); ?></strong> 24 <?php endif; ?> 24 25 </ul> 26 25 27 <form action="" method="post" class="secondary"> 26 <h3>Add a validator for this translation set</h3> 27 <p><label for="user_login">Username:</label> <input type="text" name="user_login" value="" id="user_login" /></p> 28 <p><input type="submit" name="submit" value="Add →" id="submit" /></p> 28 <h3><?php _e('Add a validator for this translation set'); ?></h3> 29 <p> 30 <label for="user_login"><?php _e('Username:'); ?></label> 31 <input type="text" name="user_login" value="" id="user_login" /> 32 </p> 33 <p> 34 <input type="submit" name="submit" value="<?php esc_attr(__('Add →')); ?>" id="submit" /> 35 </p> 36 29 37 <input type="hidden" name="action" value="add-approver" /> 30 38 </form> 31 39 <?php -
gp-templates/translation-row.php
16 16 <td class="priority" title="<?php echo esc_attr('Priority: '.gp_array_get( GP::$original->get_static( 'priorities' ), $t->priority )); ?>"> 17 17 <?php echo $priority_char[$t->priority][0] ?> 18 18 </td> 19 <td class="original"> 19 <td class="original"> 20 20 <?php echo prepare_original( esc_translation( $t->singular ) ); ?> 21 21 <?php if ( $t->context ): ?> 22 22 <span class="context" title="<?php printf( __('Context: %s'), esc_html($t->context) ); ?>"><?php echo esc_html($t->context); ?></span> 23 23 <?php endif; ?> 24 24 25 25 </td> 26 26 <td class="translation"> 27 27 <?php 28 $edit_text = $can_edit? 'Double-click to add' : 'You <a href="'.gp_url_login().'">have to login</a> to add a translation.';28 $edit_text = $can_edit? __('Double-click to add') : sprintf(__('You <a href="%s">have to login</a> to add a translation.'), gp_url_login()); 29 29 $missing_text = "<span class='missing'>$edit_text</span>"; 30 30 if ( !count( array_filter( $t->translations ) ) ): 31 31 echo $missing_text; 32 32 elseif ( !$t->plural ): 33 33 echo esc_translation( $t->translations[0] ); 34 else: ?> 34 else: ?> 35 35 <ul> 36 36 <?php 37 37 foreach( $t->translations as $translation ): 38 ?> 38 ?> 39 39 <li><?php echo $translation? esc_translation( $translation ) : $missing_text; ?></li> 40 40 <?php 41 41 endforeach; … … 73 73 </p> 74 74 <?php foreach( range( 0, $locale->nplurals - 1 ) as $plural_index ): ?> 75 75 <?php if ( $locale->nplurals > 1 ): ?> 76 <p class="plural-numbers"> This plural form is used for numbers like: <span class="numbers"><?php echo implode(', ', $locale->numbers_for_index( $plural_index) ); ?></span></p>76 <p class="plural-numbers"><?php printf(__('This plural form is used for numbers like: <span class="numbers">%s</span>'), implode(', ', $locale->numbers_for_index( $plural_index) ) ); ?></p> 77 77 <?php endif; ?> 78 <?php textareas( $t, $can_edit, $plural_index ); ?> 78 <?php textareas( $t, $can_edit, $plural_index ); ?> 79 79 <?php endforeach; ?> 80 80 <?php endif; ?> 81 81 <?php endif; ?> 82 82 </div> 83 83 84 <div class="meta"> 84 <h3> Meta</h3>85 <h3><?php _e('Meta'); ?></h3> 85 86 <dl> 86 <dt> Status:</dt>87 <dt><?php _e('Status:'); ?></dt> 87 88 <dd><?php echo display_status( $t->translation_status ); ?></dd> 88 89 <!-- 89 90 TODO: ajaxy actions for approve/set as current/reject 90 91 <?php if ( $can_approve ): ?> 91 92 <?php if ( gp_startswith( $t->translation_status, '-' ) ): ?> 92 <dd><a href="#" tabindex="-1"> Set as current</a></dd>93 <dd><a href="#" tabindex="-1"><?php _e('Set as current'); ?></a></dd> 93 94 <?php endif; ?> 94 95 <?php if ( $t->translation_status ): ?> 95 <dd><a href="#" tabindex="-1"> Reject</a></dd>96 <dd><a href="#" tabindex="-1"><?php _e('Reject'); ?></a></dd> 96 97 <?php endif; ?> 97 98 <?php endif; ?> 98 99 --> 99 100 </dl> 100 101 <!-- 101 <dl> 102 <dt> Priority:</dt>102 <dl> 103 <dt><?php _e('Priority:'); ?></dt> 103 104 <dd><?php echo esc_html($t->priority); ?></dd> 104 105 </dl> 105 --> 106 --> 106 107 107 108 <?php if ( $t->context ): ?> 108 <dl> 109 <dt> Context:</dt>109 <dl> 110 <dt><?php _e('Context:'); ?></dt> 110 111 <dd><span class="context"><?php echo esc_translation($t->context); ?></span></dd> 111 112 </dl> 112 <?php endif; ?> 113 <?php endif; ?> 113 114 <?php if ( $t->extracted_comment ): ?> 114 <dl> 115 <dt> Comment:</dt>115 <dl> 116 <dt><?php _e('Comment:'); ?></dt> 116 117 <dd><?php echo make_clickable( esc_translation($t->extracted_comment) ); ?></dd> 117 118 </dl> 118 119 <?php endif; ?> 119 120 <?php if ( $t->translation_added && $t->translation_added != '0000-00-00 00:00:00' ): ?> 120 121 <dl> 121 <dt> Date added:</dt>122 <dt><?php _e('Date added:'); ?></dt> 122 123 <dd><?php echo $t->translation_added; ?> GMT</dd> 123 </dl> 124 </dl> 124 125 <?php endif; ?> 125 126 <?php if ( $t->user_login ): ?> 126 127 <dl> 127 <dt> Translated by:</dt>128 <dd><?php echo $t->user_login; ?></dd> 129 </dl> 128 <dt><?php _e('Translated by:'); ?></dt> 129 <dd><?php echo $t->user_login; ?></dd> 130 </dl> 130 131 <?php endif; ?> 131 132 132 133 <?php references( $project, $t ); ?> 133 134 134 135 <dl> 135 <dt> Priority of the original:</dt>136 <dt><?php _e('Priority of the original:'); ?></dt> 136 137 <?php if ( $can_write ): ?> 137 138 <?php echo gp_select( 'priority-'.$t->original_id, GP::$original->get_static( 'priorities' ), $t->priority, array('class' => 'priority') ); ?> 138 139 <?php else: ?> … … 143 144 <div class="actions"> 144 145 <?php if ( $can_edit ): ?> 145 146 <button class="ok"> 146 <?php echo $can_approve? 'Add translation →' : 'Suggest new translation →'; ?>147 <?php echo $can_approve? __('Add translation →') : __('Suggest new translation →'); ?> 147 148 </button> 148 <?php endif; ?> 149 <?php endif; ?> 149 150 <a href="#" class="close"><?php _e('Cancel'); ?></a> 150 151 </div> 151 152 </td> -
gp-templates/project.php
44 44 <?php endforeach; ?> 45 45 </ul> 46 46 <?php else: ?> 47 <p> There are no translations of this project.</p>47 <p><?php _e('There are no translations of this project.'); ?></p> 48 48 <?php endif; ?> 49 49 <?php if ( $can_write ): ?> 50 50 <div class="secondary actionlist"> 51 <a href="#" class="personal-options" id="personal-options-toggle"> Personal project options ↓</a>51 <a href="#" class="personal-options" id="personal-options-toggle"><?php _e('Personal project options ↓'); ?></a> 52 52 <div class="personal-options"> 53 53 <form action="<?php echo gp_url_project( $project, '_personal' ); ?>" method="post"> 54 54 <dl> 55 55 <dt><label for="source-url-template"><?php _e('Source file URL'); ?></label></dt> 56 56 <dd> 57 57 <input type="text" value="<?php echo esc_html( $project->source_url_template() ); ?>" name="source-url-template" id="source-url-template" /> 58 <small> URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>http://trac.example.org/browser/%file%#L%line%</code></small>58 <small><?php _e('URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>http://trac.example.org/browser/%file%#L%line%</code>'); ?></small> 59 59 </dd> 60 60 </dl> 61 61 <p> 62 <input type="submit" name="submit" value=" Save →" id="save" />63 <a class="ternary" href="#" onclick="jQuery('#personal-options-toggle').click();return false;"> Cancel</a>62 <input type="submit" name="submit" value="<?php esc_attr(__('Save →')); ?>" id="save" /> 63 <a class="ternary" href="#" onclick="jQuery('#personal-options-toggle').click();return false;"><?php _e('Cancel'); ?></a> 64 64 </p> 65 65 </form> 66 66 </div> -
gp-templates/install.php
6 6 7 7 gp_tmpl_header(); 8 8 ?> 9 9 10 <?php if ($errors): ?> 10 There were some errors: 11 <pre>12 <?php echo implode("\n", $errors); ?>13 </pre>14 <?php 11 <?php _e('There were some errors:'); ?> 12 <pre> 13 <?php echo implode("\n", $errors); ?> 14 </pre> 15 <?php 15 16 else: 16 17 echo $success_message; 17 18 endif; 18 // TODO: deny access to scripts folder 19 if ( $show_htaccess_instructions ): ?> 20 <p> 21 Please add this to your <code>.htacess</code> file: 22 <pre> 23 # BEGIN GlotPress 24 <IfModule mod_rewrite.c> 25 RewriteEngine On 26 RewriteBase <?php echo $path . "\n"; ?> 27 RewriteCond %{REQUEST_FILENAME} !-f 28 RewriteCond %{REQUEST_FILENAME} !-d 29 RewriteRule . <?php echo $path; ?>index.php [L] 30 </IfModule> 31 # END GlotPress 32 </pre> 33 <strong>The default username is <code>admin</code>, whose password is simply <code>a</code>.</strong> 34 </p> 19 ?> 20 21 <?php 22 // TODO: deny access to scripts folder 23 if ( $show_htaccess_instructions ): ?> 24 <p> 25 <?php _e('Please add this to your <code>.htaccess</code> file:'); ?> 26 <pre> 27 # BEGIN GlotPress 28 <IfModule mod_rewrite.c> 29 RewriteEngine On 30 RewriteBase <?php echo $path . "\n"; ?> 31 RewriteCond %{REQUEST_FILENAME} !-f 32 RewriteCond %{REQUEST_FILENAME} !-d 33 RewriteRule . <?php echo $path; ?>index.php [L] 34 </IfModule> 35 # END GlotPress 36 </pre> 37 <?php _e('<strong>The default username is <code>admin</code>, whose password is simply <code>a</code>.</strong>'); ?> 38 </p> 35 39 <?php endif; ?> 40 36 41 <?php gp_tmpl_footer(); ?> 42 No newline at end of file -
gp-templates/project-form.php
6 6 <dt><label for="project[slug]"><?php _e('Slug'); ?></label></dt> 7 7 <dd> 8 8 <input type="text" name="project[slug]" value="<?php echo esc_html( $project->slug ); ?>" id="project[slug]"> 9 <small> If you leave the slug empty, it will be derived from the name.</small>9 <small><?php _e('If you leave the slug empty, it will be derived from the name.'); ?></small> 10 10 </dd> 11 11 12 12 <dt><label for="project[description]"><?php _e('Description'); ?></label></dt> … … 15 15 <dt><label for="project[source_url_template]"><?php _e('Source file URL'); ?></label></dt> 16 16 <dd> 17 17 <input type="text" value="<?php echo esc_html( $project->source_url_template ); ?>" name="project[source_url_template]" id="project[source_url_template]" style="width: 30em;" /> 18 <small> Public URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>http://trac.example.org/browser/%file%#L%line%</code></small>18 <small><?php _e('Public URL to a source file in the project. You can use <code>%file%</code> and <code>%line%</code>. Ex. <code>http://trac.example.org/browser/%file%#L%line%</code>'); ?></small> 19 19 </dd> 20 20 21 21 <dt><label for="project[parent_project_id]"><?php _e('Parent Project'); ?></label></dt> 22 22 <dd><?php echo gp_select( 'project[parent_project_id]', $all_project_options, $project->parent_project_id); ?></dd> 23 23 </dl> 24 24 25 <?php echo gp_js_focus_on( 'project[name]' ); ?> 26 No newline at end of file -
gp-templates/404.php
1 1 <?php 2 2 gp_title( __('Not Found < GlotPress') ); 3 3 gp_tmpl_header(); 4 ?> 5 Not Found 6 <?php gp_tmpl_footer(); ?> 7 No newline at end of file 4 5 _e('Not found'); 6 7 gp_tmpl_footer(); 8 ?> 9 No newline at end of file -
gp-templates/translations.php
16 16 ?> 17 17 <!-- TODO: use another form for bulk actions --> 18 18 <form id="upper-filters-toolbar" class="filters-toolbar" action="" method="get" accept-charset="utf-8"> 19 <?php if ( $can_approve ): ?> 20 <a href="#" class="revealing bulk"> Bulk ↓</a> <strong class="separator">•</strong>19 <?php if ( $can_approve ): ?> 20 <a href="#" class="revealing bulk"><?php _e('Bulk ↓'); ?></a> <strong class="separator">•</strong> 21 21 <?php endif; ?> 22 <a href="#" class="revealing filter"> Filter ↓</a> <span class="separator">•</span>23 <a href="#" class="revealing sort"> Sort ↓</a> <strong class="separator">•</strong>22 <a href="#" class="revealing filter"><?php _e('Filter ↓'); ?></a> <span class="separator">•</span> 23 <a href="#" class="revealing sort"><?php _e('Sort ↓'); ?></a> <strong class="separator">•</strong> 24 24 <?php 25 25 $filter_links = array(); 26 $filter_links[] = gp_link_get( $url, 'All' ); 27 $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'no', 'sort[by]' => 'priority', 'sort[how]' => 'desc', 28 'filters[status]' => 'either'), $url ), 'Untranslated' ); 29 $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'no', 'sort[by]' => 'random', 'filters[status]' => 'either'), $url ), 'Random Untranslated' ); 26 $filter_links[] = gp_link_get( $url, __('All') ); 27 $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'no', 'sort[by]' => 'priority', 'sort[how]' => 'desc', 'filters[status]' => 'either'), $url ), __('Untranslated') ); 28 $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'no', 'sort[by]' => 'random', 'filters[status]' => 'either'), $url ), __('Random Untranslated') ); 30 29 if ( $can_approve ) { 31 30 $filter_links[] = gp_link_get( add_query_arg( array('filters[translated]' => 'yes', 'filters[status]' => 'waiting'), $url ), 32 'Waiting');31 __('Waiting') ); 33 32 $filter_links[] = gp_link_get( add_query_arg( array('filters[warnings]' => 'yes', 'filters[status]' => 'current_or_waiting', 'sort[by]' => 'translation_date_added'), $url ), 34 'Warnings');35 33 __('Warnings') ); 34 36 35 } 37 36 // TODO: with warnings 38 37 // TODO: saved searches 39 38 echo implode( ' <span class="separator">•</span> ', $filter_links ); 40 39 ?> 41 <dl class="filters-expanded filters hidden clearfix"> 42 <dt><label for="filters[term]"> Term:</label></dt>43 <dd><input type="text" value="<?php echo gp_esc_attr_with_entities( gp_array_get( $filters, 'term' ) ); ?>" name="filters[term]" id="filters[term]" /></dd> 44 <dt><label for="filters[translated]"> With translation:</label></dt>40 <dl class="filters-expanded filters hidden clearfix"> 41 <dt><label for="filters[term]"><?php _e('Term:'); ?></label></dt> 42 <dd><input type="text" value="<?php echo gp_esc_attr_with_entities( gp_array_get( $filters, 'term' ) ); ?>" name="filters[term]" id="filters[term]" /></dd> 43 <dt><label for="filters[translated]"><?php _e('With translation:'); ?></label></dt> 45 44 <dd> 46 45 <?php echo gp_radio_buttons('filters[translated]', 47 46 array( 48 'yes' => 'Yes',49 'no' => 'No',50 'either' => 'Either',47 'yes' => __('Yes'), 48 'no' => __('No'), 49 'either' => __('Either'), 51 50 ), gp_array_get( $filters, 'translated', 'either' ) ); 52 ?> 53 </dd> 54 55 <dt><label for="filters[status]"> Status:</label></dt>51 ?> 52 </dd> 53 54 <dt><label for="filters[status]"><?php _e('Status:'); ?></label></dt> 56 55 <dd> 57 56 <?php echo gp_radio_buttons('filters[status]', //TODO: show only these, which user is allowed to see afterwards 58 57 array( 59 'current_or_waiting' => 'Current or waiting',60 'current' => 'Current only',61 'old' => 'Approved, but obsoleted by another string',62 'waiting' => 'Waiting approval',63 'rejected' => 'Rejected',64 'either' => 'Any',58 'current_or_waiting' => __('Current or waiting'), 59 'current' => __('Current only'), 60 'old' => __('Approved, but obsoleted by another string'), 61 'waiting' => __('Waiting approval'), 62 'rejected' => __('Rejected'), 63 'either' => __('Any'), 65 64 ), gp_array_get( $filters, 'status', 'current_or_waiting' ) ); 66 ?> 67 </dd> 65 ?> 66 </dd> 68 67 69 <dd><input type="submit" value=" Filter" name="filter" /></dd>68 <dd><input type="submit" value="<?php esc_attr(__('Filter')); ?>" name="filter" /></dd> 70 69 </dl> 71 <dl class="filters-expanded sort hidden clearfix"> 72 <dt> By:</dt>70 <dl class="filters-expanded sort hidden clearfix"> 71 <dt><?php _e('By:'); ?></dt> 73 72 <dd> 74 73 <?php echo gp_radio_buttons('sort[by]', 75 74 array( 76 'original_date_added' => 'Date added (original)',77 'translation_date_added' => 'Date added (translation)',78 'original' => 'Original string',79 'translation' => 'Translation',80 'priority' => 'Priority',81 'references' => 'Filename in source',82 'random' => 'Random',75 'original_date_added' => __('Date added (original)'), 76 'translation_date_added' => __('Date added (translation)'), 77 'original' => __('Original string'), 78 'translation' => __('Translation'), 79 'priority' => __('Priority'), 80 'references' => __('Filename in source'), 81 'random' => __('Random'), 83 82 ), gp_array_get( $sort, 'by', 'original_date_added' ) ); 84 83 ?> 85 84 </dd> 86 <dt> How:</dt>85 <dt><?php _e('How:'); ?></dt> 87 86 <dd> 88 87 <?php echo gp_radio_buttons('sort[how]', 89 88 array( 90 'asc' => 'Ascending',91 'desc' => 'Descending',89 'asc' => __('Ascending'), 90 'desc' => __('Descending'), 92 91 ), gp_array_get( $sort, 'how', 'desc' ) ); 93 92 ?> 94 93 </dd> 95 <dd><input type="submit" value=" Sort" name="sorts" /></dd>94 <dd><input type="submit" value="<?php esc_attr(__('Sort')); ?>" name="sorts" /></dd> 96 95 </dl> 97 96 <dl class="hidden bulk-actions filters-expanded clearfix"> 98 <dt class="select"> Select:</dt>97 <dt class="select"><?php _e('Select:'); ?></dt> 99 98 <dd> 100 <a href="#" class="all"> All</a>101 <a href="#" class="none"> None</a>99 <a href="#" class="all"><?php _e('All'); ?></a> 100 <a href="#" class="none"><?php _e('None'); ?></a> 102 101 </dd> 103 <dt> Approve:</dt>102 <dt><?php _e('Approve:'); ?></dt> 104 103 <dd> 105 104 <?php echo gp_radio_buttons('bulk[action]', 106 105 array( 107 'approve-all' => 'All',108 'approve-selected' => 'Selected',106 'approve-all' => __('All'), 107 'approve-selected' => __('Selected'), 109 108 ), null ); 110 ?> 109 ?> 111 110 </dd> 112 <dt> Reject:</dt>111 <dt><?php _e('Reject:'); ?></dt> 113 112 <dd> 114 113 <?php echo gp_radio_buttons('bulk[action]', 115 114 array( 116 'reject-all' => 'All',117 'reject-selected' => 'Selected',115 'reject-all' => __('All'), 116 'reject-selected' => __('Selected'), 118 117 ), null ); 119 ?> 118 ?> 120 119 </dd> 121 120 <dd> 122 121 <input type="hidden" name="bulk[redirect_to]" value="<?php echo esc_attr(gp_url_current()); ?>" id="bulk[redirect_to]"> 123 122 <input type="hidden" name="bulk[translation-ids]" value="" id="bulk[translation-ids]"> 124 <input type="submit" value=" Approve/Reject" name="approve" />125 <p class="ternary">< strong>Note:</strong> Bulk edit works only on the current page.</p>126 </dd> 127 </dl> 128 123 <input type="submit" value="<?php esc_attr(__('Approve/Reject')); ?>" name="approve" /> 124 <p class="ternary"><?php _e('<strong>Note:</strong> Bulk edit works only on the current page.'); ?></p> 125 </dd> 126 </dl> 127 129 128 </form> 130 129 131 130 <?php echo gp_pagination( $page, $per_page, $total_translations_count ); ?> 132 131 <table id="translations" class="translations clear"> 133 132 <tr> 134 <th> •</th>135 <th> Prio</th>133 <th><?php _e('•'); ?></th> 134 <th><?php _e('Prio'); ?></th> 136 135 <th class="original"><?php _e('Original string'); ?></th> 137 136 <th class="translation"><?php _e('Translation'); ?></th> 138 137 <th>—</th> 139 138 </tr> 140 139 <?php foreach( $translations as $t ): 141 140 gp_tmpl_load( 'translation-row', get_defined_vars() ); 142 ?> 141 ?> 143 142 <?php endforeach; ?> 144 143 <?php 145 144 if ( !$translations ): 146 145 ?> 147 <tr><td colspan="4"> No translations were found!</td></tr>146 <tr><td colspan="4"><?php _e('No translations were found!'); ?></td></tr> 148 147 <?php 149 148 endif; 150 149 ?> … … 163 162 $footer_links[] = $export_link; 164 163 } 165 164 if ( $can_write ) { 166 $footer_links[] = gp_link_get( gp_url_project( $project, array( $locale->slug, $translation_set->slug, '_permissions' ) ), 'Permissions');165 $footer_links[] = gp_link_get( gp_url_project( $project, array( $locale->slug, $translation_set->slug, '_permissions' ) ), __('Permissions') ); 167 166 } 168 167 echo implode( ' • ', $footer_links ); 169 168 ?> -
gp-templates/helper-functions.php
1 1 <?php 2 3 2 function prepare_original( $text ) { 4 $text = str_replace( array("\r", "\n"), "<span class='invisibles' title=' New line'>↵</span>\n", $text);5 $text = str_replace( "\t", "<span class='invisibles' title=' Tab character'>→</span>\t", $text);3 $text = str_replace( array("\r", "\n"), "<span class='invisibles' title='".esc_attr(__('New line'))."'>↵</span>\n", $text); 4 $text = str_replace( "\t", "<span class='invisibles' title='".esc_attr(__('Tab character'))."'>→</span>\t", $text); 6 5 return $text; 7 6 } 8 7 9 8 function textareas( $entry, $can_edit, $index = 0 ) { 10 9 $disabled = $can_edit? '' : 'disabled="disabled"'; 11 ?> 12 <div class="textareas"> 13 <?php if( isset( $entry->warnings[$index] ) ): 10 ?> 11 <div class="textareas"> 12 <?php 13 if( isset( $entry->warnings[$index] ) ): 14 14 $referenceable = $entry->warnings[$index]; 15 15 $warning = each( $referenceable ); 16 ?> 17 <div class="warning secondary"> 18 <strong>Warning:</strong> <?php echo esc_html( $warning['value'] ); ?> 19 <?php if( GP::$user->current()->admin() ): // TODO: allow users with write permissions, too ?> 20 <a href="#" class="discard-warning" key="<?php echo $warning['key'] ?>" index="<?php echo $index; ?>">Discard</a> 21 <?php endif; ?> 22 </div> 23 <?php endif; ?> 24 <textarea name="translation[<?php echo $entry->original_id; ?>][]" <?php echo $disabled; ?>><?php echo esc_translation(gp_array_get($entry->translations, $index)); ?></textarea> 25 <?php if ( $can_edit ): ?> 26 <p> 27 <a href="#" class="copy" tabindex="-1">Copy from original</a> 28 </p> 29 <?php else: ?> 30 <p> 31 You <a href="<?php echo gp_url_login(); ?>">have to log in</a> to edit this translation. 32 </p> 33 34 <?php endif; ?> 35 </div> 36 <?php 16 ?> 17 <div class="warning secondary"> 18 <?php printf( __('<strong>Warning:</strong> %s'), esc_html( $warning['value'] ) ); ?> 19 20 <?php if( GP::$user->current()->admin() ): // TODO: allow users with write permissions, too ?> 21 <a href="#" class="discard-warning" key="<?php echo $warning['key'] ?>" index="<?php echo $index; ?>"><?php _e('Discard'); ?></a> 22 <?php endif; ?> 23 </div> 24 <?php endif; ?> 25 <textarea name="translation[<?php echo $entry->original_id; ?>][]" <?php echo $disabled; ?>><?php echo esc_translation(gp_array_get($entry->translations, $index)); ?></textarea> 26 27 <?php if ( $can_edit ): ?> 28 <p> 29 <a href="#" class="copy" tabindex="-1"><?php _e('Copy from original'); ?></a> 30 </p> 31 <?php else: ?> 32 <p> 33 <?php printf( __('You <a href="%s">have to log in</a> to edit this translation.'), gp_url_login() ); ?> 34 </p> 35 <?php endif; ?> 36 </div> 37 <?php 37 38 } 38 39 39 40 /** … … 45 46 46 47 function display_status( $status ) { 47 48 $status = preg_replace( '/^[+-]/', '', $status); 48 return $status ? $status : 'untranslated';49 return $status ? $status : 'untranslated'; 49 50 } 50 51 51 52 function references( $project, $entry ) { 52 53 if ( !$project->source_url_template() ) return; 53 ?>54 References:55 <ul class="refs">56 <?php54 ?> 55 <?php _e('References:'); ?> 56 <ul class="refs"> 57 <?php 57 58 foreach( $entry->references as $reference ): 58 59 list( $file, $line ) = array_pad( explode( ':', $reference ), 2, 0 ); 59 60 // TODO: allow the user to override the project setting 60 61 if ( $source_url = $project->source_url( $file, $line ) ): 61 ?>62 ?> 62 63 <li><a target="_blank" tabindex="-1" href="<?php echo $source_url; ?>"><?php echo $file.':'.$line ?></a></li> 63 64 <?php 64 <?php 65 65 endif; 66 66 endforeach; 67 ?>68 </ul>67 ?> 68 </ul> 69 69 <?php 70 70 } 71 No newline at end of file -
gp-templates/header.php
11 11 <?php gp_head(); ?> 12 12 </head> 13 13 <body> 14 <div id="gp-js-message"></div> 14 <div id="gp-js-message"></div> 15 15 <h1> 16 <a href="<?php echo gp_url( '/' ); ?>"><img alt="GlotPress logo" src="<?php echo gp_url_img( 'glotpress-logo.png' ); ?>" /></a> 16 <a href="<?php echo gp_url( '/' ); ?>"> 17 <img alt="<?php esc_attr(__('GlotPress logo')); ?>" src="<?php echo gp_url_img( 'glotpress-logo.png' ); ?>" /> 18 </a> 19 17 20 <?php echo gp_breadcrumb(); ?> 18 21 <span id="hello"> 19 <?php if (GP::$user->logged_in()): 20 $user = GP::$user->current(); 21 ?> 22 Hi, <?php echo $user->user_login; ?>. 23 <a href="<?php echo gp_url('/logout')?>">Log out</a> 22 <?php 23 if (GP::$user->logged_in()): 24 $user = GP::$user->current(); 25 26 printf( __('Hi, %s.'), $user->user_login ); 27 ?> 28 <a href="<?php echo gp_url('/logout')?>"><?php _e('Log out'); ?></a> 24 29 <?php else: ?> 25 <a href="<?php echo gp_url_login(); ?>"> Log in</a>30 <a href="<?php echo gp_url_login(); ?>"><?php _e('Log in'); ?></a> 26 31 <?php endif; ?> 27 32 </span> 28 33 </h1> -
gp-templates/translation-set-form.php
2 2 <dt><label for="set[locale]"><?php _e('Locale'); ?></label></dt> 3 3 <dd> 4 4 <?php echo gp_select( 'set[locale]', $all_locale_options, $set->locale); ?> 5 <a href="#" id="copy"> Use as name</a>5 <a href="#" id="copy"><?php _e('Use as name'); ?></a> 6 6 </dd> 7 7 8 8 <dt><label for="set[name]"><?php _e('Name'); ?></label></dt> -
gp-includes/install-upgrade.php
52 52 53 53 gp_update_option( 'uri', guess_uri() ); 54 54 55 $gpdb->insert( $gpdb->projects, array('name' => 'Sample', 'slug' => 'sample', 'description' => 'A Sample Project', 'path' => 'sample') );56 $gpdb->insert( $gpdb->originals, array('project_id' => 1, 'singular' => 'GlotPress FTW', 'comment' => 'FTW means For The Win', 'context' => 'dashboard', 'references' => 'bigfile:666 little-dir/small-file.php:71' ) );57 $gpdb->insert( $gpdb->originals, array('project_id' => 1, 'singular' => 'A GlotPress', 'plural' => 'Many GlotPresses') );55 $gpdb->insert( $gpdb->projects, array('name' => __('Sample'), 'slug' => __('sample'), 'description' => __('A Sample Project'), 'path' => __('sample') ) ); 56 $gpdb->insert( $gpdb->originals, array('project_id' => 1, 'singular' => __('GlotPress FTW'), 'comment' => __('FTW means For The Win'), 'context' => 'dashboard', 'references' => 'bigfile:666 little-dir/small-file.php:71' ) ); 57 $gpdb->insert( $gpdb->originals, array('project_id' => 1, 'singular' => __('A GlotPress'), 'plural' => __('Many GlotPresses') ) ); 58 58 59 $gpdb->insert( $gpdb->translation_sets, array( 'name' => 'My Translation', 'slug' => 'my', 'project_id' => 1, 'locale' => 'bg', ) );59 $gpdb->insert( $gpdb->translation_sets, array( 'name' => __('My Translation'), 'slug' => __('my'), 'project_id' => 1, 'locale' => 'bg', ) ); 60 60 61 61 // TODO: ask the user for an e-mail -- borrow WordPress install process 62 62 if ( !defined('CUSTOM_USER_TABLE') ) { -
gp-includes/cli.php
42 42 $this->usage(); 43 43 } 44 44 $project = GP::$project->by_path( $this->options['p'] ); 45 if ( !$project ) $this->error( 'Project not found!');45 if ( !$project ) $this->error( __('Project not found!') ); 46 46 47 47 $locale = GP_Locales::by_slug( $this->options['l'] ); 48 if ( !$locale ) $this->error( 'Locale not found!');48 if ( !$locale ) $this->error( __('Locale not found!') ); 49 49 50 50 $this->options['t'] = gp_array_get( $this->options, 't', 'default' ); 51 51 52 52 $translation_set = GP::$translation_set->by_project_id_slug_and_locale( $project->id, $this->options['t'], $locale->slug ); 53 if ( !$translation_set ) $this->error( 'Translation set not found!');53 if ( !$translation_set ) $this->error( __('Translation set not found!') ); 54 54 55 55 $this->action_on_translation_set( $translation_set ); 56 56 } -
gp-includes/l10n.php
10 10 if (isset($locale)) 11 11 return apply_filters( 'locale', $locale ); 12 12 13 // GP_LANG is defined in gp-config. 14 if ( defined('GP_LANG') ) 15 $locale = GP_LANG; 16 13 17 // TODO: get locale from DB 14 18 15 19 if (empty($locale)) -
gp-includes/warnings.php
71 71 $len_trans = gp_strlen( $translation ); 72 72 if ( !( $this->length_lower_bound*$len_src < $len_trans && $len_trans < $this->length_upper_bound*$len_src ) && 73 73 ( !gp_in( '_abbreviation', $original ) && !gp_in( '_initial', $original ) ) ) { 74 return 'Lenghts of source and translation differ too much.';74 return __('Lenghts of source and translation differ too much.'); 75 75 } 76 76 return true; 77 77 } … … 82 82 $original_parts = preg_split($tag_re, $original, -1, PREG_SPLIT_DELIM_CAPTURE); 83 83 $translation_parts = preg_split($tag_re, $translation, -1, PREG_SPLIT_DELIM_CAPTURE); 84 84 if ( count( $original_parts) > count( $translation_parts ) ) { 85 return 'Missing tags from translation.';85 return __('Missing tags from translation.'); 86 86 } 87 87 if ( count( $original_parts) < count( $translation_parts ) ) { 88 return 'Too many tags in translation.';88 return __('Too many tags in translation.'); 89 89 } 90 90 foreach( gp_array_zip( $original_parts, $translation_parts ) as $tags ) { 91 91 list( $original_tag, $translation_tag ) = $tags; … … 117 117 $original_count = gp_array_get( $original_counts, $placeholder, 0 ); 118 118 $translation_count = gp_array_get( $translation_counts, $placeholder, 0 ); 119 119 if ( $original_count > $translation_count ) { 120 return 'Missing '.$placeholder.' placeholder in translation.';120 return sprintf(__('Missing %s placeholder in translation.'), $placeholder); 121 121 } 122 122 if ( $original_count < $translation_count ) { 123 return 'Extra '.$placeholder.' placeholder in translation.';123 return sprintf(__('Extra %s placeholder in translation.'), $placeholder); 124 124 } 125 125 } 126 126 return true; … … 137 137 138 138 function warning_both_begin_end_on_newlines( $original, $translation, $locale ) { 139 139 if ( gp_endswith( $original, "\n" ) xor gp_endswith( $translation, "\n" ) ) { 140 return 'Original and translation should both end on newline.';140 return __('Original and translation should both end on newline.'); 141 141 } 142 142 if ( gp_startswith( $original, "\n" ) xor gp_startswith( $translation, "\n" ) ) { 143 return 'Original and translation should both begin on newline.';143 return __('Original and translation should both begin on newline.'); 144 144 } 145 145 return true; 146 146 } -
gp-config-sample.php
34 34 /**#@-*/ 35 35 36 36 /** 37 * GlotPress Localized Language, defaults to English. 38 * 39 * Change this to localize WordPress. A corresponding MO file for the chosen 40 * language must be installed to languages/. For example, install 41 * fr_FR.mo to languages/ and set GP_LANG to 'fr_FR' to enable French 42 * language support. 43 */ 44 define('GP_LANG', ''); 45 46 /** 37 47 * GlotPress Database Table prefix. 38 48 * 39 49 * You can have multiple installations in one database if you give each a unique … … 41 51 */ 42 52 $gp_table_prefix = 'gp_'; 43 53 44 ?> 54 ?> 55 No newline at end of file
