WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/26/2014 07:58:33 PM (6 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/install.php

    r29611 r29630  
    3838/** Load WordPress Administration Upgrade API */
    3939require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     40
     41/** Load WordPress Translation Install API */
     42require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
    4043
    4144/** Load wpdb */
     
    179182}
    180183
     184$langugage = '';
     185if ( ! empty( $_REQUEST['language'] ) ) {
     186    $langugage = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
     187}
     188
    181189switch($step) {
    182190    case 0: // Step 0
    183191
    184         if ( empty( $_GET['language'] ) && ( $languages = wp_get_available_translations_from_api() ) ) {
     192        if ( empty( $langugage ) && ( $languages = wp_get_available_translations() ) ) {
    185193            display_header( 'language-chooser' );
    186194            echo '<form id="setup" method="post" action="?step=1">';
     
    193201
    194202    case 1: // Step 1, direct link or from language chooser.
    195         if ( ! empty( $_REQUEST['language'] ) ) {
    196             $loaded_language = wp_install_download_language_pack( $_REQUEST['language'] );
     203        if ( ! empty( $langugage ) ) {
     204            $loaded_language = wp_download_language_pack( $langugage );
    197205            if ( $loaded_language ) {
    198                 wp_install_load_language( $loaded_language );
     206                load_default_textdomain( $loaded_language );
    199207            }
    200208        }
     
    212220        break;
    213221    case 2:
    214         if ( !empty( $_REQUEST['language'] ) ) {
    215             $loaded_language = wp_install_load_language( $_REQUEST['language'] );
     222        if ( ! empty( $langugage ) && load_default_textdomain( $langugage ) ) {
     223            $loaded_language = $langugage;
    216224        } else {
    217225            $loaded_language = 'en_US';
     
    227235        $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : '';
    228236        $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
    229         $admin_email  = isset( $_POST['admin_email']  ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
    230         $public       = isset( $_POST['blog_public']  ) ? (int) $_POST['blog_public'] : 0;
     237        $admin_email  = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
     238        $public       = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0;
    231239
    232240        // Check e-mail address.
Note: See TracChangeset for help on using the changeset viewer.