Making WordPress.org


Ignore:
Timestamp:
02/25/2019 10:22:52 PM (7 years ago)
Author:
ocean90
Message:

Translate: Remove workarounds for locale variants.

GP_Locales returns the correct locale now.

See #4206.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-plugins.php

    r5524 r8348  
    7171            foreach ( $translation_locale_complete as $locale_slug => $total_complete ) :
    7272                $gp_locale = GP_Locales::by_slug( $locale_slug );
    73                 $set_slug  = 'default';
    7473
    75                 // Variants (de/formal for example) don't have GP_Locales in this context
    76                 if ( ! $gp_locale && ( list( $base_locale_slug, $set_slug ) = explode( '/', $locale_slug ) ) ) :
    77                     $_gp_locale = GP_Locales::by_slug( $base_locale_slug );
    78                     if ( $_gp_locale ) {
    79                         $gp_locale = clone $_gp_locale;
    80                         // Just append it for now..
    81                         $gp_locale->wp_locale .= '/' . $set_slug;
    82                         $gp_locale->english_name .= ' (' . ucfirst( $set_slug ) . ')';
    83                     }
    84                 endif;
     74                if ( ! $gp_locale || ! $gp_locale->wp_locale ) {
     75                    continue;
     76                }
    8577
    86                 if ( ! $gp_locale || ! $gp_locale->wp_locale ) :
    87                     continue;
    88                 endif;
    89             ?>
     78                list( $locale, $set_slug ) = array_merge( explode( '/', $locale_slug ), [ 'default' ] );
     79                ?>
    9080                <tr>
    9181                    <th title="<?php echo esc_attr( $gp_locale->wp_locale ); ?>">
    92                         <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) ) ); ?>">
     82                        <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $locale, $set_slug, $project->path ) ) ); ?>">
    9383                            <?php echo esc_html( $gp_locale->english_name ); ?>
    9484                        </a>
     
    10999                                        }
    110100
    111                                         $link_url  = gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) );
     101                                        $link_url  = gp_url( gp_url_join( 'locale', $locale, $set_slug, $project->path ) );
    112102                                        $link_text = number_format( $percent );
    113103                                    else :
    114104                                        $percent_class = (int) ( $percent / 10 ) * 10;
    115                                         $link_url  = gp_url_project( $project->path, gp_url_join( $subproject_slug, $gp_locale->slug, $set_slug ) );
     105                                        $link_url  = gp_url_project( $project->path, gp_url_join( $subproject_slug, $locale, $set_slug ) );
    116106                                        $link_text = "$percent%";
    117107
Note: See TracChangeset for help on using the changeset viewer.