Make WordPress Core


Ignore:
Timestamp:
08/04/2014 08:46:42 PM (10 years ago)
Author:
nacin
Message:

Language chooser imporvements.

  • Use a translated 'Continue' string.
  • Go back to using a select element.
  • Only show a spinner when we're installing a language.

see #28577.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r29260 r29372  
    21942194endif;
    21952195
     2196/**
     2197 * Output the input fields for the language selection form on the installation screen.
     2198 *
     2199 * @since 4.0.0
     2200 *
     2201 * @see wp_get_available_translations_from_api()
     2202 *
     2203 * @param array $languages Array of available languages (populated via the Translations API).
     2204 */
    21962205function wp_install_language_form( $languages ) {
    2197     echo "<fieldset>\n";
    2198     echo "<legend class='screen-reader-text'>Select a default language</legend>\n";
    2199     echo '<input type="radio" checked="checked" class="screen-reader-input language-chooser-input" name="language" id="language_default" value="">';
    2200     echo '<label for="language_default" lang="en">English (United States)</label>';
     2206    $installed_languages = get_available_languages();
     2207
     2208    echo "<label class='screen-reader-text' for='language'>Select a default language</label>\n";
     2209    echo "<select size='14' name='language' id='language'>\n";
     2210    echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>';
    22012211    echo "\n";
    22022212
     
    22042214        if ( isset( $languages[ WPLANG ] ) ) {
    22052215            $language = $languages[ WPLANG ];
    2206             echo '<input type="radio" name="language" checked="checked" class="' . esc_attr( $language['language'] ) . ' screen-reader-input" id="language_wplang" value="' . esc_attr( $language['language'] ) . '">';
    2207             echo '<label for="language_wplang" lang="' . esc_attr( $language['iso'][1] ) . '">' . esc_html( $language['native_name'] ) . "</label>\n";
     2216            echo '<option value="' . esc_attr( $language['language'] ) . '" lang="' . esc_attr( $language['iso'][1] ) . '">' . esc_html( $language['native_name'] ) . "</option>\n";
    22082217        }
    22092218    }
    22102219
    22112220    foreach ( $languages as $language ) {
    2212         echo '<input type="radio" name="language" class="' . esc_attr( $language['language'] ) . ' screen-reader-input language-chooser-input" id="language_'. esc_attr( $language['language'] ) .'" value="' . esc_attr( $language['language'] ) . '">';
    2213         echo '<label for="language_' . esc_attr( $language['language'] ) . '" lang="' . esc_attr( $language['iso'][1] ) . '">' . esc_html( $language['native_name'] ) . "</label>\n";
    2214     }
    2215     echo "</fieldset>\n";
    2216     echo '<p class="step"><span class="spinner"></span><input type="submit" class="button button-primary button-hero" value="&raquo;" /></p>';
     2221        printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
     2222            esc_attr( $language['language'] ),
     2223            esc_attr( $language['iso'][1] ),
     2224            esc_attr( $language['strings']['continue'] ),
     2225            in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
     2226            esc_html( $language['native_name'] ) );
     2227    }
     2228    echo "</select>\n";
     2229    echo '<p class="step"><span class="spinner"></span><input id="language-continue" type="submit" class="button button-primary button-large" value="Continue" /></p>';
    22172230}
    22182231
Note: See TracChangeset for help on using the changeset viewer.