Making WordPress.org


Ignore:
Timestamp:
02/25/2019 10:22:52 PM (6 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-themes.php

    r5502 r8348  
    6262            foreach ( $translation_locale_complete as $locale_slug => $total_complete ) :
    6363                $gp_locale = GP_Locales::by_slug( $locale_slug );
    64                 $set_slug  = 'default';
    6564
    66                 // Variants (de/formal for example) don't have GP_Locales in this context
    67                 if ( ! $gp_locale && ( list( $base_locale_slug, $set_slug ) = explode( '/', $locale_slug ) ) ) :
    68                     $_gp_locale = GP_Locales::by_slug( $base_locale_slug );
    69                     if ( $_gp_locale ) {
    70                         $gp_locale = clone $_gp_locale;
    71                         // Just append it for now..
    72                         $gp_locale->wp_locale .= '/' . $set_slug;
    73                         $gp_locale->english_name .= ' (' . ucfirst( $set_slug ) . ')';
    74                     }
    75                 endif;
     65                if ( ! $gp_locale || ! $gp_locale->wp_locale ) {
     66                    continue;
     67                }
    7668
    77                 if ( ! $gp_locale || ! $gp_locale->wp_locale ) :
    78                     continue;
    79                 endif;
    80             ?>
     69                list( $locale, $set_slug ) = array_merge( explode( '/', $locale_slug ), [ 'default' ] );
     70                ?>
    8171                <tr>
    8272                    <th title="<?php echo esc_attr( $gp_locale->wp_locale ); ?>">
    83                         <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) ) ); ?>">
     73                        <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $locale, $set_slug, $project->path ) ) ); ?>">
    8474                            <?php echo esc_html( $gp_locale->english_name ); ?>
    8575                        </a>
     
    10090                                        }
    10191
    102                                         $link_url  = gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) );
     92                                        $link_url  = gp_url( gp_url_join( 'locale', $locale, $set_slug, $project->path ) );
    10393                                        $link_text = number_format( $percent );
    10494                                    else :
    10595                                        $percent_class = (int) ( $percent / 10 ) * 10;
    106                                         $link_url  = gp_url_project( $project->path, gp_url_join( $gp_locale->slug, $set_slug ) );
     96                                        $link_url  = gp_url_project( $project->path, gp_url_join( $locale, $set_slug ) );
    10797                                        $link_text = "$percent%";
    10898
Note: See TracChangeset for help on using the changeset viewer.