Make WordPress Core


Ignore:
Timestamp:
08/26/2014 07:58:33 PM (9 years ago)
Author:
ocean90
Message:

Language packs: No WPLANG anymore.

  • The WPLANG constant is no longer needed. Remove define('WPLANG', ); from wp-config-sample.php. Populate WPLANG option based on the WPLANG constant. When get_option('WPLANG') is an empty string it will override WPLANG.
  • Introduce translations_api() which is available to communicate with the translation API. Move translation install related functions to a new file.
  • Replace mu_dropdown_languages() with wp_dropdown_languages(). wp_dropdown_languages() is now populated by the translation API.
  • Remove wp_install_load_language() and allow load_default_textdomain() to switch a core translation.

fixes #13069, #15677, #19760, #28730, #29281.

File:
1 edited

Legend:

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

    r29514 r29630  
    303303</tr>
    304304<?php do_settings_fields('general', 'default'); ?>
    305 <?php
    306     $languages = get_available_languages();
    307     if ( $languages ) :
    308 ?>
     305
     306<?php
     307$languages = get_available_languages();
     308if ( ! empty( $languages ) ) {
     309    ?>
    309310    <tr>
    310         <th width="33%" scope="row"><label for="WPLANG"><?php _e('Site Language') ?></label></th>
     311        <th width="33%" scope="row"><label for="WPLANG"><?php _e( 'Site Language' ); ?></label></th>
    311312        <td>
    312             <?php wp_dropdown_languages( array(
     313            <?php
     314            $locale = get_locale();
     315            if ( ! in_array( $locale, $languages ) ) {
     316                $locale = '';
     317            }
     318
     319            wp_dropdown_languages( array(
    313320                'name'      => 'WPLANG',
    314321                'id'        => 'WPLANG',
    315                 'selected'  => get_option( 'WPLANG' ),
     322                'selected'  => $locale,
    316323                'languages' => $languages,
    317             ) ); ?>
     324            ) );
     325
     326            // Add note about deprecated WPLANG constant.
     327            if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && $locale !== WPLANG ) {
     328                if ( is_super_admin() ) {
     329                    ?>
     330                    <p class="description">
     331                        <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>' ); ?>
     332                    </p>
     333                    <?php
     334                }
     335                _deprecated_argument( 'define()', '4.0', sprintf( __( 'The %s constant in your %s file is no longer needed.' ), 'WPLANG', 'wp-config.php' ) );
     336            }
     337            ?>
    318338        </td>
    319339    </tr>
    320 <?php
    321     endif;
     340    <?php
     341}
    322342?>
    323343</table>
Note: See TracChangeset for help on using the changeset viewer.