Advertisements

mu_dropdown_languages

Definition:
function mu_dropdown_languages( $lang_files = array() {}

Parameters

  • $lang_files
  • $current

Defined filters

  • mu_dropdown_languages
    apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current )

Source code

function mu_dropdown_languages( $lang_files = array(), $current = '' ) {

	$flag = false;

	$output = array();



	foreach ( (array) $lang_files as $val ) {

		$code_lang = basename( $val, '.mo' );



		if ( $code_lang == 'en_US' ) { // American English

			$flag = true;

			$ae = __( 'American English' );

			$output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';

		} elseif ( $code_lang == 'en_GB' ) { // British English

			$flag = true;

			$be = __( 'British English' );

			$output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';

		} else {

			$translated = format_code_lang( $code_lang );

			$output[$translated] =  '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';

		}



	}



	if ( $flag === false ) // WordPress english

		$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . "</option>";



	// Order by name

	uksort( $output, 'strnatcasecmp' );



	$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );

	echo implode( "\n\t", $output );

}

2415

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: