Ticket #57: local-inc.diff
| File local-inc.diff, 5.4 KB (added by momo360modena, 2 years ago) |
|---|
-
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 }
