Making WordPress.org


Ignore:
Timestamp:
07/23/2014 06:52:58 PM (12 years ago)
Author:
iandunn
Message:

WordCamp Post Types: Use actual string for text domain.

Variables cannot be used for text domains because gettext runs outside of PHP.
See ​http://markjaquith.wordpress.com/2011/10/06/translating-wordpress-plugins-and-themes-dont-get-clever/

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/inc/widgets.php

    r708 r758  
    1212class WCB_Widget_Sponsors extends WP_Widget {
    1313
    14         protected $textdomain = ''; // @see __construct()
    15 
    1614        function __construct() {
    17                 global $wcpt_plugin;
    18                 $this->textdomain = $wcpt_plugin->textdomain;
    19 
    2015                $widget_ops = array(
    2116                        'classname' => 'wcb_widget_sponsors',
    22                         'description' => __( 'Your WordCamp’s Sponsors', $this->textdomain ),
     17                        'description' => __( 'Your WordCamp’s Sponsors', 'wordcamporg' ),
    2318                );
    24                 $this->WP_Widget( 'wcb_sponsors', __( 'Sponsors', $this->textdomain ), $widget_ops );
     19                $this->WP_Widget( 'wcb_sponsors', __( 'Sponsors', 'wordcamporg' ), $widget_ops );
    2520        }
    2621
    … …  
    8782                $title = $instance['title'];
    8883                ?>
    89                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', $this->textdomain ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
     84                <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wordcamporg' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
    9085                <?php
    9186        }
    … …  
    111106class WCPT_Widget_Speakers extends WP_Widget {
    112107
    113         protected $textdomain = ''; // @see __construct()
    114108        protected $cache_time = 3600; // seconds
    115109
    116110        function __construct() {
    117                 global $wcpt_plugin;
    118                 $this->textdomain = $wcpt_plugin->textdomain;
    119 
    120111                $widget_ops = array(
    121112                        'classname' => 'wcpt_widget_speakers',
    122                         'description' => __( 'Your WordCamp&#8217;s Speakers', $this->textdomain ),
     113                        'description' => __( 'Your WordCamp&#8217;s Speakers', 'wordcamporg' ),
    123114                );
    124                 $this->WP_Widget( 'wcpt_speakers', __( 'Speakers', $this->textdomain ), $widget_ops );
     115                $this->WP_Widget( 'wcpt_speakers', __( 'Speakers', 'wordcamporg' ), $widget_ops );
    125116        }
    126117
    … …  
    160151                $speakers_permalink = $wcpt_plugin->get_speakers_permalink();
    161152                if ( ! empty( $speakers_permalink ) )
    162                         printf( '<a class="wcpt-speakers-link" href="%s">%s</a>', esc_url( $speakers_permalink ), esc_html( __( 'View all speakers &rarr;', $this->textdomain ) ) );
     153                        printf( '<a class="wcpt-speakers-link" href="%s">%s</a>', esc_url( $speakers_permalink ), esc_html( __( 'View all speakers &rarr;', 'wordcamporg' ) ) );
    163154
    164155                echo $args['after_widget'];
    … …  
    178169                $random = (bool) $instance['random'];
    179170                ?>
    180                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', $this->textdomain ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
    181                 <p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Number of speakers to show:', $this->textdomain ); ?> <input type="text" size="3" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" value="<?php echo esc_attr( $count ); ?>" /></label></p>
     171                <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wordcamporg' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
     172                <p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Number of speakers to show:', 'wordcamporg' ); ?> <input type="text" size="3" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" value="<?php echo esc_attr( $count ); ?>" /></label></p>
    182173                <p>
    183174                        <input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id( 'random' ); ?>" name="<?php echo $this->get_field_name( 'random' ); ?>" <?php checked( $random ); ?> />
    184                         <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e( 'Display in random order', $this->textdomain ); ?></label>
     175                        <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e( 'Display in random order', 'wordcamporg' ); ?></label>
    185176                </p>
    186177
    … …  
    217208class WCPT_Widget_Sessions extends WP_Widget {
    218209
    219         protected $textdomain = ''; // @see __construct()
    220210        protected $cache_time = 3600; // seconds
    221211
    222212        function __construct() {
    223                 global $wcpt_plugin;
    224                 $this->textdomain = $wcpt_plugin->textdomain;
    225 
    226213                $widget_ops = array(
    227214                        'classname' => 'wcpt_widget_sessions',
    228                         'description' => __( 'Show off your WordCamp sessions', $this->textdomain ),
     215                        'description' => __( 'Show off your WordCamp sessions', 'wordcamporg' ),
    229216                );
    230                 $this->WP_Widget( 'wcpt_sessions', __( 'Sessions', $this->textdomain ), $widget_ops );
     217                $this->WP_Widget( 'wcpt_sessions', __( 'Sessions', 'wordcamporg' ), $widget_ops );
    231218        }
    232219
    … …  
    270257                $sessions_permalink = $wcpt_plugin->get_sessions_permalink();
    271258                if ( ! empty( $sessions_permalink ) )
    272                         printf( '<a class="wcpt-sessions-link" href="%s">%s</a>', esc_url( $sessions_permalink ), esc_html( __( 'View all sessions &rarr;', $this->textdomain ) ) );
     259                        printf( '<a class="wcpt-sessions-link" href="%s">%s</a>', esc_url( $sessions_permalink ), esc_html( __( 'View all sessions &rarr;', 'wordcamporg' ) ) );
    273260
    274261                echo $args['after_widget'];
    … …  
    288275                $random = (bool) $instance['random'];
    289276                ?>
    290                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', $this->textdomain ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
    291                 <p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Number of speakers to show:', $this->textdomain ); ?> <input type="text" size="3" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" value="<?php echo esc_attr( $count ); ?>" /></label></p>
     277                <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wordcamporg' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
     278                <p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Number of speakers to show:', 'wordcamporg' ); ?> <input type="text" size="3" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" value="<?php echo esc_attr( $count ); ?>" /></label></p>
    292279                <p>
    293280                        <input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id( 'random' ); ?>" name="<?php echo $this->get_field_name( 'random' ); ?>" <?php checked( $random ); ?> />
    294                         <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e( 'Display in random order', $this->textdomain ); ?></label>
     281                        <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e( 'Display in random order', 'wordcamporg' ); ?></label>
    295282                </p>
    296283
    … …  
    326313 */
    327314class WCPT_Widget_Organizers extends WP_Widget {
    328 
    329         protected $textdomain = ''; // @see __construct()
    330315        protected $cache_time = 3600; // seconds
    331316
    332317        function __construct() {
    333                 global $wcpt_plugin;
    334                 $this->textdomain = $wcpt_plugin->textdomain;
    335 
    336318                $widget_ops = array(
    337319                        'classname' => 'wcpt_widget_organizers',
    338                         'description' => __( 'Display your organizing team in the sidebar', $this->textdomain ),
     320                        'description' => __( 'Display your organizing team in the sidebar', 'wordcamporg' ),
    339321                );
    340                 $this->WP_Widget( 'wcpt_organizers', __( 'Organizers', $this->textdomain ), $widget_ops );
     322                $this->WP_Widget( 'wcpt_organizers', __( 'Organizers', 'wordcamporg' ), $widget_ops );
    341323        }
    342324
    … …  
    376358                $organizers_permalink = $wcpt_plugin->get_organizers_permalink();
    377359                if ( ! empty( $organizers_permalink ) )
    378                         printf( '<a class="wcpt-organizers-link" href="%s">%s</a>', esc_url( $organizers_permalink ), esc_html( __( 'Organizing team &rarr;', $this->textdomain ) ) );
     360                        printf( '<a class="wcpt-organizers-link" href="%s">%s</a>', esc_url( $organizers_permalink ), esc_html( __( 'Organizing team &rarr;', 'wordcamporg' ) ) );
    379361
    380362                echo $args['after_widget'];
    … …  
    394376                $random = (bool) $instance['random'];
    395377                ?>
    396                 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', $this->textdomain ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
    397                 <p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Number of organizers to show:', $this->textdomain ); ?> <input type="text" size="3" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" value="<?php echo esc_attr( $count ); ?>" /></label></p>
     378                <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wordcamporg' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
     379                <p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Number of organizers to show:', 'wordcamporg' ); ?> <input type="text" size="3" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" value="<?php echo esc_attr( $count ); ?>" /></label></p>
    398380                <p>
    399381                        <input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id( 'random' ); ?>" name="<?php echo $this->get_field_name( 'random' ); ?>" <?php checked( $random ); ?> />
    400                         <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e( 'Display in random order', $this->textdomain ); ?></label>
     382                        <label for="<?php echo $this->get_field_id( 'random' ); ?>"><?php _e( 'Display in random order', 'wordcamporg' ); ?></label>
    401383                </p>
    402384
Note: See TracChangeset for help on using the changeset viewer.