Making WordPress.org

Changeset 2118


Ignore:
Timestamp:
11/23/2015 07:27:59 PM (9 years ago)
Author:
ocean90
Message:

Translate: Add a warning to plugin pages if a plugin has only one sub-project.

Location:
sites/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/wp-plugins.php

    r2089 r2118  
    2626        // Split out into $[Locale][Project] = %
    2727        $translation_locale_statuses = array();
     28        $sub_projects = array();
    2829        foreach ( $rows as $set ) {
    2930
     
    3435            }
    3536            $sub_project = str_replace( "$project_path/", '', $set->path );
     37            $sub_projects[ $sub_project ] = true;
    3638
    3739            /*
     
    5557            ksort( $translation_locale_statuses[ $locale_key ], SORT_NATURAL );
    5658        }
    57         unset( $project_path, $locale_key, $rows, $set, $sub_project );
     59
     60        // If the plugin has only one sub-project something went wrong, likely a missing
     61        // text domain which is why no 'code' projects will be created.
     62        $has_error = count( $sub_projects ) < 2;
     63
     64        unset( $project_path, $locale_key, $rows, $set, $sub_project, $sub_projects );
    5865
    5966        // Calculate a list of [Locale] = % subtotals
  • sites/trunk/translate.wordpress.org/public_html/gp-templates-new/helper-functions.php

    r2105 r2118  
    11<?php
    2 wp_register_style( 'wporg-translate', 'https://wordpress.org/translate/gp-templates-new/style.css', array( 'base' ), '20151111' );
     2wp_register_style( 'wporg-translate', 'https://wordpress.org/translate/gp-templates-new/style.css', array( 'base' ), '20151123' );
    33gp_enqueue_style( 'wporg-translate' );
    44
  • sites/trunk/translate.wordpress.org/public_html/gp-templates-new/projects-wp-plugins.php

    r2076 r2118  
    3434    </div>
    3535</div>
     36
     37<?php if ( $has_error ) : ?>
     38<div class="wporg-notice wporg-notice-warning">
     39    <p>This plugin is not properly prepared for localization. If you would like to translate this plugin, <a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/' . $project->slug ); ?>">please contact the author.</a></p>
     40</div>
     41<?php endif; ?>
    3642
    3743<div class="stats-table">
  • sites/trunk/translate.wordpress.org/public_html/gp-templates-new/style.css

    r2072 r2118  
    827827}
    828828
     829.wporg-notice {
     830    background: #fff;
     831    border-left: 4px solid #fff;
     832    margin: 5px 15px 15px 15px;
     833    padding: 1px 12px;
     834}
     835
     836.wporg-notice p {
     837    margin: 0.5em 0;
     838    padding: 2px;
     839}
     840
     841.wporg-notice-warning {
     842    background: #fff8e5;
     843    border-left-color:#ffb900;
     844}
     845
     846
    829847/* Responsive styles */
    830848@media (max-width: 700px) {
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/helper-functions.php

    r2073 r2118  
    11<?php
    22
    3 wp_enqueue_style( 'wporg', gp_url_ssl( gp_url_public_root() ) . 'gp-templates/style.css', array( 'base' ), '20151111' );
     3wp_enqueue_style( 'wporg', gp_url_ssl( gp_url_public_root() ) . 'gp-templates/style.css', array( 'base' ), '20151123' );
    44
    55add_action( 'tmpl_load_locations', function( $locations, $template, $args, $template_path ) {
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/projects-wp-plugins.php

    r2076 r2118  
    3434    </div>
    3535</div>
     36
     37<?php if ( $has_error ) : ?>
     38<div class="wporg-notice wporg-notice-warning">
     39    <p>This plugin is not properly prepared for localization. If you would like to translate this plugin, <a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/' . $project->slug ); ?>">please contact the author.</a></p>
     40</div>
     41<?php endif; ?>
    3642
    3743<div class="stats-table">
  • sites/trunk/translate.wordpress.org/public_html/gp-templates/style.css

    r2072 r2118  
    827827}
    828828
     829.wporg-notice {
     830    background: #fff;
     831    border-left: 4px solid #fff;
     832    margin: 5px 15px 15px 15px;
     833    padding: 1px 12px;
     834}
     835
     836.wporg-notice p {
     837    margin: 0.5em 0;
     838    padding: 2px;
     839}
     840
     841.wporg-notice-warning {
     842    background: #fff8e5;
     843    border-left-color:#ffb900;
     844}
     845
     846
    829847/* Responsive styles */
    830848@media (max-width: 700px) {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/routes/wp-plugins.php

    r2109 r2118  
    2626        // Split out into $[Locale][Project] = %
    2727        $translation_locale_statuses = array();
     28        $sub_projects = array();
    2829        foreach ( $rows as $set ) {
    2930
     
    3435            }
    3536            $sub_project = str_replace( "$project_path/", '', $set->path );
     37            $sub_projects[ $sub_project ] = true;
    3638
    3739            /*
     
    5557            ksort( $translation_locale_statuses[ $locale_key ], SORT_NATURAL );
    5658        }
    57         unset( $project_path, $locale_key, $rows, $set, $sub_project );
     59
     60        // If the plugin has only one sub-project something went wrong, likely a missing
     61        // text domain which is why no 'code' projects will be created.
     62        $has_error = count( $sub_projects ) < 2;
     63
     64        unset( $project_path, $locale_key, $rows, $set, $sub_project, $sub_projects );
    5865
    5966        // Calculate a list of [Locale] = % subtotals
Note: See TracChangeset for help on using the changeset viewer.