WordPress.org

Making WordPress.org

Changeset 1910


Ignore:
Timestamp:
09/24/2015 10:39:12 AM (4 years ago)
Author:
ocean90
Message:

Theme Directory: Improve strings with style.css references and add translator comments.

Props ramiy,SergeyBiryukov.
Fixes #1058.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r1906 r1910  
    103103        $style_css = $this->get_style_css( $theme_files );
    104104        if ( empty( $style_css ) ) {
    105             return sprintf( __( 'The zip file must include a file named %s.', 'wporg-themes' ), '<code>style.css</code>' );
     105            /* translators: %s: style.css */
     106            return sprintf( __( 'The zip file must include a file named %s.', 'wporg-themes' ),
     107                '<code>style.css</code>'
     108            );
    106109        }
    107110
    108111        // We have a stylesheet, let's set up the theme, theme post, and author.
    109         $this->theme      = new WP_Theme( basename( dirname( $style_css ) ), dirname( dirname( $style_css ) ) );
     112        $this->theme = new WP_Theme( basename( dirname( $style_css ) ), dirname( dirname( $style_css ) ) );
    110113
    111114        // We need a screen shot. People love screen shots.
    112115        if ( ! $this->has_screenshot( $theme_files ) ) {
    113             return sprintf( __( 'The zip file must include a file named %1$s or %2$s.', 'wporg-themes' ), '<code>screenshot.png</code>', '<code>screenshot.jpg</code>' );
     116            /* translators: 1: screenshot.png, 2: screenshot.jpg */
     117            return sprintf( __( 'The zip file must include a file named %1$s or %2$s.', 'wporg-themes' ),
     118                '<code>screenshot.png</code>',
     119                '<code>screenshot.jpg</code>'
     120            );
    114121        }
    115122
     
    120127
    121128        if ( ! $this->theme_name = $this->theme->get( 'Name' ) ) {
    122             return sprintf( __( 'The theme has no name. Add it to style.css and upload the theme again. <a href="%s">Theme Style Sheets</a>', 'wporg-themes' ), __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' ) );
     129            $error = __( 'The theme has no name.', 'wporg-themes' ) . ' ';
     130
     131            /* translators: 1: comment header line, 2: style.css, 3: Codex URL */
     132            $error .= sprintf( __( 'Add a %1$s line to your %2$s file and upload the theme again. <a href="%3$s">Theme Style Sheets</a>', 'wporg-themes' ),
     133                '<code>Theme Name:</code>',
     134                '<code>style.css</code>',
     135                __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' )
     136            );
     137
     138            return $error;
    123139        }
    124140
     
    130146        // Make sure it doesn't use a slug deemed not to be used by the public.
    131147        if ( $this->has_reserved_slug() ) {
    132             return sprintf( __( 'Sorry, the theme name %s is reserved for use by WordPress Core. Please change the name of your theme in <code>style.css</code> and upload it again.', 'wporg-themes' ), '<code>' . $this->theme_slug . '</code>' );
     148            /* translators: 1: theme slug, 2: style.css */
     149            return sprintf( __( 'Sorry, the theme name %1$s is reserved for use by WordPress Core. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ),
     150                '<code>' . $this->theme_slug . '</code>',
     151                '<code>style.css</code>'
     152            );
    133153        }
    134154
     
    138158        $theme_description = $this->strip_non_utf8( (string) $this->theme->get( 'Description' ) );
    139159        if ( empty( $theme_description ) ) {
    140             return sprintf( __( 'The theme has no description. Add it to <code>style.css</code> and upload the theme again. <a href="%s">Theme Style Sheets</a>', 'wporg-themes' ), __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' ) );
     160            $error = __( 'The theme has no description.', 'wporg-themes' ) . ' ';
     161
     162            /* translators: 1: comment header line, 2: style.css, 3: Codex URL */
     163            $error .= sprintf( __( 'Add a %1$s line to your %2$s file and upload the theme again. <a href="%3$s">Theme Style Sheets</a>', 'wporg-themes' ),
     164                '<code>Description:</code>',
     165                '<code>style.css</code>',
     166                __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' )
     167            );
     168
     169            return $error;
    141170        }
    142171
    143172        if ( ! $this->theme->get( 'Tags' ) ) {
    144             return __( 'The stylesheet has no tags. Add a Tags: line to your <code>style.css</code> file and upload the zip file again.', 'wporg-themes' );
     173            $error = __( 'The theme has no tags.', 'wporg-themes' ) . ' ';
     174
     175            /* translators: 1: comment header line, 2: style.css, 3: Codex URL */
     176            $error .= sprintf( __( 'Add a %1$s line to your %2$s file and upload the theme again. <a href="%3$s">Theme Style Sheets</a>', 'wporg-themes' ),
     177                '<code>Tags:</code>',
     178                '<code>style.css</code>',
     179                __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' )
     180            );
     181
     182            return $error;
    145183        }
    146184
    147185        if ( ! $this->theme->get( 'Version' ) ) {
    148             return __( 'The stylesheet has no version. Add a Version: line to your <code>style.css</code> file and upload the zip file again.', 'wporg-themes' );
     186            $error = __( 'The theme has no version.', 'wporg-themes' ) . ' ';
     187
     188            /* translators: 1: comment header line, 2: style.css, 3: Codex URL */
     189            $error .= sprintf( __( 'Add a %1$s line to your %2$s file and upload the theme again. <a href="%3$s">Theme Style Sheets</a>', 'wporg-themes' ),
     190                '<code>Version:</code>',
     191                '<code>style.css</code>',
     192                __( 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet', 'wporg-themes' )
     193            );
     194
     195            return $error;
    149196        }
    150197
    151198        if ( preg_match( '|[^\d\.]|', $this->theme->get( 'Version' ) ) ) {
    152             return __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix your Version: line in <code>style.css</code> and upload your theme again.', 'wporg-themes' );
     199            /* translators: %s: style.css */
     200            return sprintf( __( 'Version strings can only contain numeric and period characters (like 1.2). Please fix your Version: line in %s and upload your theme again.', 'wporg-themes' ),
     201                '<code>style.css</code>'
     202            );
    153203        }
    154204
    155205        // Make sure we have version that is higher than any previously uploaded version of this theme.
    156206        if ( ! empty( $this->theme_post ) && ! version_compare( $this->theme->get( 'Version' ), $this->theme_post->max_version, '>' ) ) {
    157             return sprintf( __( 'You need to upload a version of %1$s higher than %2$s. Increase the theme version number in <code>style.css</code>, then upload your zip file again.', 'wporg-themes' ), $this->theme->display( 'Name' ), '<code>' . $this->theme_post->max_version . '</code>' );
     207            /* translators: 1: theme name, 2: theme version, 3: style.css */
     208            return sprintf( __( 'You need to upload a version of %1$s higher than %2$s. Increase the theme version number in %3$s, then upload your zip file again.', 'wporg-themes' ),
     209                $this->theme->display( 'Name' ),
     210                '<code>' . $this->theme_post->max_version . '</code>',
     211                '<code>style.css</code>'
     212            );
    158213        }
    159214
     
    167222        // Check for child theme's parent in the directory (non-buddypress only)
    168223        if ( $this->theme->parent() && ! in_array( 'buddypress', $this->theme->get( 'Tags' ) ) && ! $this->is_parent_available() ) {
    169             return sprintf( __( 'There is no theme called %s in the directory. For child themes, you must use a parent theme that already exists in the directory.', 'wporg-themes' ), '<code>' . $this->theme->parent() . '</code>' );
     224            /* translators: %s: parent theme */
     225            return sprintf( __( 'There is no theme called %s in the directory. For child themes, you must use a parent theme that already exists in the directory.', 'wporg-themes' ),
     226                '<code>' . $this->theme->parent() . '</code>'
     227            );
    170228        }
    171229
    172230        // Is there already a theme with the name name by a different author?
    173231        if ( ! empty( $this->theme_post ) && $this->theme_post->post_author != $this->author->ID ) {
    174             return sprintf( __( 'There is already a theme called %s by a different author. Please change the name of your theme in <code>style.css</code> and upload it again.', 'wporg-themes' ), '<code>' . $this->theme_slug . '</code>' );
     232            /* translators: 1: theme slug, 2: style.css */
     233            return sprintf( __( 'There is already a theme called %1$s by a different author. Please change the name of your theme in %2$s and upload it again.', 'wporg-themes' ),
     234                '<code>' . $this->theme_slug . '</code>',
     235                '<code>style.css</code>'
     236            );
    175237        }
    176238
    177239        // We know it's the correct author, now we can check if it's suspended.
    178240        if ( ! empty( $this->theme_post ) && 'suspend' === $this->theme_post->post_status ) {
    179             return sprintf( __( 'This theme is suspended from the Theme Repository and it can&rsquo;t be updated. If you have any questions about this please contact %s.', 'wporg-themes' ), '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>' );
     241            /* translators: %s: mailto link */
     242            return sprintf( __( 'This theme is suspended from the Theme Repository and it can&rsquo;t be updated. If you have any questions about this please contact %s.', 'wporg-themes' ),
     243                '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>'
     244            );
    180245        }
    181246
     
    186251
    187252            if ( ! $result ) {
    188                 return sprintf( __( 'Your theme has failed the theme check. Please correct the problems with it and upload it again. You can also use the <a href="%1$s">Theme Check Plugin</a> to test your theme before uploading. If you have any questions about this please post them to %2$s.', 'wporg-themes' ), '//wordpress.org/plugins/theme-check/', '<a href="https://make.wordpress.org/themes">https://make.wordpress.org/themes</a>' );
     253                /* translators: 1: Theme Check Plugin URL, 2: make.wordpress.org/themes */
     254                return sprintf( __( 'Your theme has failed the theme check. Please correct the problems with it and upload it again. You can also use the <a href="%1$s">Theme Check Plugin</a> to test your theme before uploading. If you have any questions about this please post them to %2$s.', 'wporg-themes' ),
     255                    '//wordpress.org/plugins/theme-check/',
     256                    '<a href="https://make.wordpress.org/themes">https://make.wordpress.org/themes</a>'
     257                );
    189258            }
    190259        }
     
    200269
    201270        if ( ! $ticket_id  ) {
    202             return sprintf( __( 'There was an error creating a Trac ticket for your theme, please report this error to %s', 'wporg-themes' ), '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>' );
     271            /* translators: %s: mailto link */
     272            return sprintf( __( 'There was an error creating a Trac ticket for your theme, please report this error to %s', 'wporg-themes' ),
     273                '<a href="mailto:themes@wordpress.org">themes@wordpress.org</a>'
     274            );
    203275        }
    204276
     
    215287
    216288        // Success!
    217         return sprintf( __( 'Thank you for uploading %1$s to the WordPress Theme Directory. We&rsquo;ve sent you an email verifying that we&rsquo;ve received it. Feedback will be provided at <a href="%2$s">%2$s</a>', 'wporg-themes' ), $this->theme->display( 'Name' ), esc_url( 'https://themes.trac.wordpress.org/ticket/' . $ticket_id ) );
     289        /* translators: 1: theme name, 2: Trac ticket URL */
     290        return sprintf( __( 'Thank you for uploading %1$s to the WordPress Theme Directory. We&rsquo;ve sent you an email verifying that we&rsquo;ve received it. Feedback will be provided at <a href="%2$s">%2$s</a>', 'wporg-themes' ),
     291            $this->theme->display( 'Name' ),
     292            esc_url( 'https://themes.trac.wordpress.org/ticket/' . $ticket_id )
     293        );
    218294    }
    219295
     
    599675    public function send_email_notification( $ticket_id ) {
    600676        if ( ! empty( $this->theme_post ) ) {
    601             $email_subject = sprintf( __( '[WordPress Themes] %1$s, new version %2$s', 'wporg-themes' ), $this->theme->display( 'Name' ), $this->theme->display( 'Version' ) );
    602             $email_content = sprintf( __( "Thank you for uploading version %s of %s.\n\nFeedback will be provided at %s\n\n--\nThe WordPress.org Themes Team\nhttps://make.wordpress.org/themes", 'wporg-themes' ), $this->theme->display( 'Version' ), $this->theme->display( 'Name' ), 'https://themes.trac.wordpress.org/ticket/' . $ticket_id );
     677            /* translators: 1: theme name, 2: theme version */
     678            $email_subject = sprintf( __( '[WordPress Themes] %1$s, new version %2$s', 'wporg-themes' ),
     679                $this->theme->display( 'Name' ),
     680                $this->theme->display( 'Version' )
     681            );
     682
     683            /* translators: 1: theme version, 2: theme name, 3: Trac ticket URL */
     684            $email_content = sprintf( __( 'Thank you for uploading version %1$s of %2$s.
     685
     686Feedback will be provided at %3$s
     687
     688--
     689The WordPress.org Themes Team
     690https://make.wordpress.org/themes', 'wporg-themes' ),
     691                $this->theme->display( 'Version' ),
     692                $this->theme->display( 'Name' ),
     693                'https://themes.trac.wordpress.org/ticket/' . $ticket_id
     694            );
    603695        } else {
    604             $email_subject = sprintf( __( '[WordPress Themes] New Theme - %s', 'wporg-themes' ), $this->theme->display( 'Name' ) );
    605             $email_content = sprintf( __( "Thank you for uploading %s to the WordPress Theme Directory. If your theme is selected to be part of the directory we'll send a follow up email.\n\nFeedback will be provided at %s\n\n--\nThe WordPress.org Themes Team\nhttps://make.wordpress.org/themes", 'wporg-themes' ), $this->theme->display( 'Name' ), 'https://themes.trac.wordpress.org/ticket/' . $ticket_id );
     696            /* translators: %s: theme name */
     697            $email_subject = sprintf( __( '[WordPress Themes] New Theme - %s', 'wporg-themes' ),
     698                $this->theme->display( 'Name' )
     699            );
     700
     701            /* translators: 1: theme name, 2: Trac ticket URL */
     702            $email_content = sprintf( __( 'Thank you for uploading %1$s to the WordPress Theme Directory. If your theme is selected to be part of the directory we\'ll send a follow up email.
     703
     704Feedback will be provided at %2$s
     705
     706--
     707The WordPress.org Themes Team
     708https://make.wordpress.org/themes', 'wporg-themes' ),
     709                $this->theme->display( 'Name' ),
     710                'https://themes.trac.wordpress.org/ticket/' . $ticket_id
     711            );
    606712        }
    607713
Note: See TracChangeset for help on using the changeset viewer.