Make WordPress Core

Changeset 39885


Ignore:
Timestamp:
01/12/2017 04:27:17 AM (10 years ago)
Author:
SergeyBiryukov
Message:

I18N: Move "Site Language" setting above "Timezone".

This brings all locale-specific site settings closer together and prevents the language setting from being pushed down by unrelated settings added by plugins.

Props johnjamesjacoby.
Fixes #38562.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options-general.php

    r39068 r39885  
    121121</td>
    122122</tr>
    123 <?php } ?>
     123<?php }
     124
     125$languages = get_available_languages();
     126$translations = wp_get_available_translations();
     127if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
     128        $languages[] = WPLANG;
     129}
     130if ( ! empty( $languages ) || ! empty( $translations ) ) {
     131        ?>
     132        <tr>
     133                <th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
     134                <td>
     135                        <?php
     136                        $locale = get_locale();
     137                        if ( ! in_array( $locale, $languages ) ) {
     138                                $locale = '';
     139                        }
     140
     141                        wp_dropdown_languages( array(
     142                                'name'         => 'WPLANG',
     143                                'id'           => 'WPLANG',
     144                                'selected'     => $locale,
     145                                'languages'    => $languages,
     146                                'translations' => $translations,
     147                                'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(),
     148                        ) );
     149
     150                        // Add note about deprecated WPLANG constant.
     151                        if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
     152                                if ( is_super_admin() ) {
     153                                        ?>
     154                                        <p class="description">
     155                                                <strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
     156                                        </p>
     157                                        <?php
     158                                }
     159                                _deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
     160                        }
     161                        ?>
     162                </td>
     163        </tr>
     164        <?php
     165}
     166?>
    124167<tr>
    125168<?php
    … …  
    318361</tr>
    319362<?php do_settings_fields('general', 'default'); ?>
    320 
    321 <?php
    322 $languages = get_available_languages();
    323 $translations = wp_get_available_translations();
    324 if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
    325         $languages[] = WPLANG;
    326 }
    327 if ( ! empty( $languages ) || ! empty( $translations ) ) {
    328         ?>
    329         <tr>
    330                 <th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
    331                 <td>
    332                         <?php
    333                         $locale = get_locale();
    334                         if ( ! in_array( $locale, $languages ) ) {
    335                                 $locale = '';
    336                         }
    337 
    338                         wp_dropdown_languages( array(
    339                                 'name'         => 'WPLANG',
    340                                 'id'           => 'WPLANG',
    341                                 'selected'     => $locale,
    342                                 'languages'    => $languages,
    343                                 'translations' => $translations,
    344                                 'show_available_translations' => ( ! is_multisite() || is_super_admin() ) && wp_can_install_language_pack(),
    345                         ) );
    346 
    347                         // Add note about deprecated WPLANG constant.
    348                         if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
    349                                 if ( is_super_admin() ) {
    350                                         ?>
    351                                         <p class="description">
    352                                                 <strong><?php _e( 'Note:' ); ?></strong> <?php printf( __( 'The %s constant in your %s file is no longer needed.' ), '<code>WPLANG</code>', '<code>wp-config.php</code>' ); ?>
    353                                         </p>
    354                                         <?php
    355                                 }
    356                                 _deprecated_argument( 'define()', '4.0.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
    357                         }
    358                         ?>
    359                 </td>
    360         </tr>
    361         <?php
    362 }
    363 ?>
    364363</table>
    365364
Note: See TracChangeset for help on using the changeset viewer.