WordPress.org

Making WordPress.org

Ticket #1058: class-wporg-themes-upload.php.2.patch

File class-wporg-themes-upload.php.2.patch, 10.1 KB (added by ramiy, 4 years ago)
  • public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

     
    102102                // Do we have a stylesheet? Life is kind of pointless without.
    103103                $style_css = $this->get_style_css( $theme_files );
    104104                if ( empty( $style_css ) ) {
     105                        /* translators: %s: style.css */
    105106                        return sprintf( __( 'The zip file must include a file named %s.', 'wporg-themes' ), '<code>style.css</code>' );
    106107                }
    107108
     
    110111
    111112                // We need a screen shot. People love screen shots.
    112113                if ( ! $this->has_screenshot( $theme_files ) ) {
     114                        /* translators: 1: screenshot.png 2: screenshot.jpg */
    113115                        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>' );
    114116                }
    115117
     
    119121                // Let's check some theme headers, shall we?
    120122
    121123                if ( ! $this->theme_name = $this->theme->get( 'Name' ) ) {
    122                         return __( "The theme has no name. Add it to style.css and upload the theme again. <a href='https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet'>Theme Style Sheets</a>", 'wporg-themes' );
     124                        /* translators: 1: style.css 2: codex link */
     125                        return sprintf( __( 'The theme has no name. Add it to %1$s and upload the theme again. <a href="%2$s">Theme Style Sheets</a>', 'wporg-themes' ), '<code>style.css</code>', 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet' );
    123126                }
    124127
    125128                // determine the theme slug based on the name of the theme in the stylesheet
     
    129132
    130133                // Make sure it doesn't use a slug deemed not to be used by the public.
    131134                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>' );
     135                        /* translators: 1: theme slug 2: style.css */
     136                        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' ), '<code>' . $this->theme_slug . '</code>', '<code>style.css</code>' );
    133137                }
    134138
    135139                // populate the theme post and author
     
    137141
    138142                $theme_description = $this->strip_non_utf8( (string) $this->theme->get( 'Description' ) );
    139143                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' );
     144                        /* translators: 1: style.css 2: codex link */
     145                        return sprintf( __( 'The theme has no description. Add it to %1$s and upload the theme again. <a href="%2$s">Theme Style Sheets</a>', 'wporg-themes' ), '<code>style.css</code>', 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet' );
    141146                }
    142147
    143148                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' );
     149                        /* translators: 1: style.css 2: codex link */
     150                        return sprintf( __( 'The theme has no tags. Add it to %1$s and upload the theme again. <a href="%2$s">Theme Style Sheets</a>', 'wporg-themes' ), '<code>style.css</code>', 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet' );
    145151                }
    146152
    147153                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' );
     154                        /* translators: 1: style.css 2: codex link */
     155                        return sprintf( __( 'The theme has no version. Add it to %1$s and upload the theme again. <a href="%2$s">Theme Style Sheets</a>', 'wporg-themes' ), '<code>style.css</code>', 'https://codex.wordpress.org/Theme_Development#Theme_Style_Sheet' );
    149156                }
    150157
    151158                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' );
     159                        /* translators: %s: style.css */
     160                        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' ), '<code>style.css</code>' );
    153161                }
    154162
    155163                // Make sure we have version that is higher than any previously uploaded version of this theme.
    156164                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>' );
     165                        /* translators: 1: Theme display name 2: Theme max version 3: style.css */
     166                        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' ), $this->theme->display( 'Name' ), '<code>' . $this->theme_post->max_version . '</code>', '<code>style.css</code>' );
    158167                }
    159168
    160169                // Prevent duplicate URLs.
     
    166175
    167176                // Check for child theme's parent in the directory (non-buddypress only)
    168177                if ( $this->theme->parent() && ! in_array( 'buddypress', $this->theme->get( 'Tags' ) ) && ! $this->is_parent_available() ) {
     178                        /* translators: %s: parent theme */
    169179                        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>' );
    170180                }
    171181
    172182                // Is there already a theme with the name name by a different author?
    173183                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>' );
     184                        /* translators: 1: Theme slug 2: style.css */
     185                        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' ), '<code>' . $this->theme_slug . '</code>', '<code>style.css</code>' );
    175186                }
    176187
    177188                // We know it's the correct author, now we can check if it's suspended.
    178189                if ( ! empty( $this->theme_post ) && 'suspend' === $this->theme_post->post_status ) {
     190                        /* translators: %s: mailto link */
    179191                        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>' );
    180192                }
    181193
     
    185197                        $result = $this->check_theme( $theme_files );
    186198
    187199                        if ( ! $result ) {
     200                                /* translators: %s: codex link */
    188201                                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>' );
    189202                        }
    190203                }
     
    199212                $ticket_id = $this->create_or_update_trac_ticket();
    200213
    201214                if ( ! $ticket_id  ) {
     215                        /* translators: %s: mailto link */
    202216                        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>' );
    203217                }
    204218
     
    214228                do_action( 'theme_upload', $this->theme );
    215229
    216230                // Success!
     231                /* translators: 1: theme display name 2: ticket link */
    217232                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 ) );
    218233        }
    219234
     
    411426                $this->trac_ticket = new StdClass;
    412427
    413428                // todo - check trac xml-rpc, maybe data needs to be escaped before sending it there.
     429                /* translators: 1: theme display name 2: theme version */
    414430                $this->trac_ticket->summary = sprintf( 'THEME: %1$s – %2$s', $this->theme->display( 'Name' ), $this->theme->display( 'Version' ) );
    415431
    416432                // Keywords
     
    598614         */
    599615        public function send_email_notification( $ticket_id ) {
    600616                if ( ! empty( $this->theme_post ) ) {
     617                        /* translators: 1: theme display name 2: theme version */
    601618                        $email_subject = sprintf( __( '[WordPress Themes] %1$s, new version %2$s', 'wporg-themes' ), $this->theme->display( 'Name' ), $this->theme->display( 'Version' ) );
    602619                        $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 );
    603620                } else {
     621                        /* translators: %s: theme display name */
    604622                        $email_subject = sprintf( __( '[WordPress Themes] New Theme - %s', 'wporg-themes' ), $this->theme->display( 'Name' ) );
    605623                        $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 );
    606624                }