WordPress.org

Ready to get started?Download WordPress

Plugin Directory

WP Chinese Conversion

Adds the language conversion function between Chinese Simplified and Chinese Traditional to your WP Blog. Released under GPL license.

Upload the WPCC plugin to your blog, Activate it,

To use this plugin, just add it's widget to the sidebar. The widget will output the Chinese Simplfied/ Traditional Version's link of current page. You can also use the <?php wpcc_output_navi(); ?> tag in your template.

上传插件, 激活. 然后直接到侧边栏里添加本插件的Widget即可. Widget里已经定义好了相应元素的class 和id, 请自己加CSS. 你也可以在模板中调用 <?php wpcc_output_navi(); ?> 标签.

Widget将输出当前页面各种中文版本的导航链接. 如果你想自定义输出内容, 可以参考下面的代码, 在模板里添加.

<?php
//必须声明为全局变量,因为WP通过函数载入模板的...

global $wpcc_target_lang;          //当前页面语言的中文代码, 例如zh-cn; 如果是原始版本则为false.
global $wpcc_noconversion_url;  //当前页面原始版本链接, 即原来的Permalink.
global $wpcc_langs_urls;            //关联数组, 含有当前页面各个中文语言版本URL, 键值为语言代码(如zh-tw).
global $wpcc_langs;                   //二维数组, 保存有插件所有支持的中文语言相关信息, 外层键值为语言代码(如zh-tw). 内层键值为连续索引.

$output = '<div id="wpcc_output">';
$output .= '<span id="wpcc_original_link" class="' .
    ( $wpcc_target_lang == false ? 'wpcc_current_lang' : 'wpcc_lang' ) .
    '" ><a href="' . $wpcc_noconversion_url . '" title="不转换">不转换</a></span>';

foreach( $wpcc_langs_urls as $key => $value ) {
    $output .= '<span id="wpcc_' . $key . '" class="' . //你可以根据自己需要修改, 如把span改为li 
    ( $wpcc_target_lang == $key ? 'wpcc_current_lang' : 'wpcc_lang' ) .
    '" ><a href="' . $value .
    '" title="' . $wpcc_langs[$key][2] . '" >' . $wpcc_langs[$key][2] . '</a></span>'; // $wpcc_langs[$key][2]为语言名称, 如 "简体中文", "港澳繁體", "臺灣正體"等
}

$output .= '</div>';
echo $output;

?>

设置本插件请到后台"Options"菜单里的"Chinese Conversion"子菜单页.

Requires: 3.7 or higher
Compatible up to: 3.7.1
Last Updated: 2013-11-8
Downloads: 9,770

Ratings

4 stars
4.6 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1