mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 11:35:48 +00:00
Introduce wp_dropdown_languages() and use it on general settings.
Early rough cut. Obviously not fully implemented. see #15677. Built from https://develop.svn.wordpress.org/trunk@29007 git-svn-id: http://core.svn.wordpress.org/trunk@28795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7a1351b411
commit
4e2f1bd155
@ -304,14 +304,17 @@ endfor;
|
||||
<?php do_settings_fields('general', 'default'); ?>
|
||||
<?php
|
||||
$languages = get_available_languages();
|
||||
if ( is_multisite() && !empty( $languages ) ):
|
||||
if ( $languages ) :
|
||||
?>
|
||||
<tr>
|
||||
<th width="33%" scope="row"><?php _e('Site Language') ?></th>
|
||||
<td>
|
||||
<select name="WPLANG" id="WPLANG">
|
||||
<?php mu_dropdown_languages( $languages, get_option('WPLANG') ); ?>
|
||||
</select>
|
||||
<?php wp_dropdown_languages( array(
|
||||
'name' => 'WPLANG',
|
||||
'id' => 'WPLANG',
|
||||
'selected' => get_option( 'WPLANG' ),
|
||||
'languages' => $languages,
|
||||
) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -72,7 +72,7 @@ if ( is_multisite() && !is_super_admin() && 'update' != $action )
|
||||
wp_die(__('Cheatin’ uh?'));
|
||||
|
||||
$whitelist_options = array(
|
||||
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string' ),
|
||||
'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
|
||||
'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
|
||||
'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
|
||||
'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
|
||||
@ -107,7 +107,6 @@ if ( !is_multisite() ) {
|
||||
}
|
||||
} else {
|
||||
$whitelist_options['general'][] = 'new_admin_email';
|
||||
$whitelist_options['general'][] = 'WPLANG';
|
||||
|
||||
/**
|
||||
* Filter whether the post-by-email functionality is enabled.
|
||||
|
@ -816,3 +816,24 @@ function wp_get_pomo_file_data( $po_file ) {
|
||||
}
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Language selector. More to come.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
function wp_dropdown_languages( $args = array() ) {
|
||||
if ( isset( $args['languages'] ) ) {
|
||||
$languages = $args['languages'];
|
||||
} else {
|
||||
$languages = get_available_languages();
|
||||
}
|
||||
|
||||
printf( '<select name="%s" id="%s">', esc_attr( $args['name'] ), esc_attr( $args['id'] ) );
|
||||
echo '<option value="">en_US</option>';
|
||||
foreach ( $languages as $language ) {
|
||||
$selected = selected( $language, $args['selected'], false );
|
||||
echo '<option value="' . esc_attr( $language ) .'"' . $selected . '>' . $language . '</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user