WordPress.org

Make WordPress Core

Changeset 31447


Ignore:
Timestamp:
02/13/2015 11:22:38 AM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r31074 r31447  
    142142            printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
    143143                esc_attr( $language['language'] ),
    144                 esc_attr( $language['iso'][1] ),
     144                esc_attr( current( $language['iso'] ) ),
    145145                esc_attr( $language['strings']['continue'] ),
    146146                in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
     
    154154        printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
    155155            esc_attr( $language['language'] ),
    156             esc_attr( $language['iso'][1] ),
     156            esc_attr( current( $language['iso'] ) ),
    157157            esc_attr( $language['strings']['continue'] ),
    158158            in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
  • trunk/src/wp-includes/l10n.php

    r31090 r31447  
    897897                'language'    => $translation['language'],
    898898                'native_name' => $translation['native_name'],
    899                 'lang'        => $translation['iso'][1],
     899                'lang'        => current( $translation['iso'] ),
    900900            );
    901901
     
    943943                '<option value="%s" lang="%s"%s>%s</option>',
    944944                esc_attr( $translation['language'] ),
    945                 esc_attr( $translation['iso'][1] ),
     945                esc_attr( current( $translation['iso'] ) ),
    946946                selected( $translation['language'], $args['selected'], false ),
    947947                esc_html( $translation['native_name'] )
Note: See TracChangeset for help on using the changeset viewer.