Avoid a PHP notice in wp_install_language_form()
and wp_dropdown_languages()
if the language doesn't have a ISO 639-1 code.
props barrykooij. fixes #31319. git-svn-id: https://develop.svn.wordpress.org/trunk@31447 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
997b9733c9
commit
bde2a220d9
@ -141,7 +141,7 @@ function wp_install_language_form( $languages ) {
|
||||
$language = $languages[ $wp_local_package ];
|
||||
printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
|
||||
esc_attr( $language['language'] ),
|
||||
esc_attr( $language['iso'][1] ),
|
||||
esc_attr( current( $language['iso'] ) ),
|
||||
esc_attr( $language['strings']['continue'] ),
|
||||
in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
|
||||
esc_html( $language['native_name'] ) );
|
||||
@ -153,7 +153,7 @@ function wp_install_language_form( $languages ) {
|
||||
foreach ( $languages as $language ) {
|
||||
printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
|
||||
esc_attr( $language['language'] ),
|
||||
esc_attr( $language['iso'][1] ),
|
||||
esc_attr( current( $language['iso'] ) ),
|
||||
esc_attr( $language['strings']['continue'] ),
|
||||
in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
|
||||
esc_html( $language['native_name'] ) );
|
||||
|
@ -896,7 +896,7 @@ function wp_dropdown_languages( $args = array() ) {
|
||||
$languages[] = array(
|
||||
'language' => $translation['language'],
|
||||
'native_name' => $translation['native_name'],
|
||||
'lang' => $translation['iso'][1],
|
||||
'lang' => current( $translation['iso'] ),
|
||||
);
|
||||
|
||||
// Remove installed language from available translations.
|
||||
@ -942,7 +942,7 @@ function wp_dropdown_languages( $args = array() ) {
|
||||
$structure[] = sprintf(
|
||||
'<option value="%s" lang="%s"%s>%s</option>',
|
||||
esc_attr( $translation['language'] ),
|
||||
esc_attr( $translation['iso'][1] ),
|
||||
esc_attr( current( $translation['iso'] ) ),
|
||||
selected( $translation['language'], $args['selected'], false ),
|
||||
esc_html( $translation['native_name'] )
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user