Ticket #57: local-inc.diff

File local-inc.diff, 5.4 KB (added by momo360modena, 2 years ago)

Changes in gp-includes

  • gp-includes/install-upgrade.php

     
    5252         
    5353        gp_update_option( 'uri', guess_uri() ); 
    5454         
    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') ) ); 
    5858         
    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', ) ); 
    6060         
    6161        // TODO: ask the user for an e-mail -- borrow WordPress install process 
    6262        if ( !defined('CUSTOM_USER_TABLE') ) { 
  • gp-includes/cli.php

     
    4242                        $this->usage(); 
    4343                } 
    4444                $project = GP::$project->by_path( $this->options['p'] ); 
    45                 if ( !$project ) $this->error( 'Project not found!' ); 
     45                if ( !$project ) $this->error( __('Project not found!') ); 
    4646                 
    4747                $locale = GP_Locales::by_slug( $this->options['l'] ); 
    48                 if ( !$locale ) $this->error( 'Locale not found!' ); 
     48                if ( !$locale ) $this->error( __('Locale not found!') ); 
    4949                 
    5050                $this->options['t'] = gp_array_get( $this->options, 't', 'default' ); 
    5151                 
    5252                $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!') ); 
    5454 
    5555                $this->action_on_translation_set( $translation_set ); 
    5656        } 
  • gp-includes/l10n.php

     
    1010        if (isset($locale)) 
    1111                return apply_filters( 'locale', $locale ); 
    1212 
     13        // GP_LANG is defined in gp-config. 
     14        if ( defined('GP_LANG') ) 
     15                $locale = GP_LANG; 
     16                 
    1317        // TODO: get locale from DB 
    1418 
    1519        if (empty($locale)) 
  • gp-includes/warnings.php

     
    7171                $len_trans = gp_strlen( $translation ); 
    7272                if ( !( $this->length_lower_bound*$len_src < $len_trans && $len_trans < $this->length_upper_bound*$len_src ) && 
    7373                                ( !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.'); 
    7575                } 
    7676                return true; 
    7777        } 
     
    8282                $original_parts = preg_split($tag_re, $original, -1, PREG_SPLIT_DELIM_CAPTURE); 
    8383                $translation_parts = preg_split($tag_re, $translation, -1, PREG_SPLIT_DELIM_CAPTURE); 
    8484                if ( count( $original_parts) > count( $translation_parts ) ) { 
    85                         return 'Missing tags from translation.'; 
     85                        return __('Missing tags from translation.'); 
    8686                } 
    8787                if ( count( $original_parts) < count( $translation_parts ) ) { 
    88                         return 'Too many tags in translation.'; 
     88                        return __('Too many tags in translation.'); 
    8989                } 
    9090                foreach( gp_array_zip( $original_parts, $translation_parts ) as $tags ) { 
    9191                        list( $original_tag, $translation_tag ) = $tags; 
     
    117117                        $original_count = gp_array_get( $original_counts, $placeholder, 0 ); 
    118118                        $translation_count = gp_array_get( $translation_counts, $placeholder, 0 ); 
    119119                        if ( $original_count > $translation_count ) { 
    120                                 return 'Missing '.$placeholder.' placeholder in translation.'; 
     120                                return sprintf(__('Missing %s placeholder in translation.'), $placeholder); 
    121121                        } 
    122122                        if ( $original_count < $translation_count ) { 
    123                                 return 'Extra '.$placeholder.' placeholder in translation.'; 
     123                                return sprintf(__('Extra %s placeholder in translation.'), $placeholder); 
    124124                        } 
    125125                } 
    126126                return true; 
     
    137137         
    138138        function warning_both_begin_end_on_newlines( $original, $translation, $locale ) { 
    139139                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.'); 
    141141                } 
    142142                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.'); 
    144144                } 
    145145                return true; 
    146146        }