Chinese Translation name conflict
-
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>'; }
- The topic ‘Chinese Translation name conflict’ is closed to new replies.