For the English code name, it include a conditional loop to distinguish for “en_GB”, “en_US”…and so on
Because my project require Traditional Chinese and Simplified Chinese for selection, I found that all of the Chinese become “Chinese”. Same as English, I added the conditional loop to distinguish:
according to the standard country code found:
https://codex.www.ads-software.com/WordPress_in_Your_Language
//in line 135
if ( $code_lang == 'zh_TW' ) { // American English
$flag = true;
$twc = __( 'Traditional Chinese Taiwan');
$output[$twc] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $twc . '</option>';
} elseif ( $code_lang == 'zh_CN' ) { // British English
$flag = true;
$sc = __( 'Simplified Chinese');
$output[$sc] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $sc . '</option>';
} elseif ( $code_lang == 'zh_HK' ) { // British English
$flag = true;
$hkc = __( 'Traditional Chinese Hong Kong');
$output[$hkc] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $hkc . '</option>';
} elseif ( $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 = __(al_format_code_lang( $code_lang ));
$output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
}
]]>
I enable my WP_DEBUG, and i got this notices on my front,admin & error log on my wp 3.4.2 multisite:
]]>Notice: Undefined offset: 0 in /home/site/public_html/wp-content/plugins/admin-locale/admin-locale.php on line 117
Great plugin. Simple and works with 3.3.1. ??
]]>Hi,
This plugin is great, I’ve used it on one of my websites.
On a second website, I can’t get it to work. When I try to change the language from English to Romanian, and save, it just goes back to English.
I almost gave up on using the plugin for this site (admin locale), but then I got it to work by mistake.
When I moved my site to a new server, I had to manually (search & replace) change the old url to the new url in the database sql file. When I saved the sql database file with the changes, I saved it by mistake as utf-8. I imported the file to the new server, but I had serious problems with the character set display. —- BUT, NOW the ADMIN LOCALE WORKED!!! —–
So I deleted the database, went back to the sql file and saved it with character set “Western (Mac OS Roman)” – which was the default anyway. This fixed the problem with the character set but now the Admin Locale doesn’t work anymore.
Can you tell me what specific fields in the database I might have to change to make this work, without changing the character set for the entire database?
Thank you, Yaron.