CJK-AutoTagger

CJK-AutoTagger automatically wraps CJK characters in your site with `<span lang=””></span>` tags, so that you can style them separately.

Author:Thomas Tsoi (profile at wordpress.org)
WordPress version required:2.7
WordPress version tested:2.92
Plugin version:1.0
Added to WordPress repository:28-03-2010
Last updated:28-03-2010
Warning! This plugin has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.
Rating, %:0
Rated by:0
Plugin URI:http://www.thomastsoi.com/software/cjk-autota...
Total downloads:832
plugin download
Click to start download

Do you often mix Latin letters and Chinese, Japanese or Korean (CJK) characters in the same post or in the title? Did you find it difficult to style both types of characters satisfactorily using the same CSS style?

CJK-AutoTagger Automatically wraps CJK characters in your site with <span lang=""></span> tags, so that you can style them separately. You can choose what to <span>-wrap (refer to the screen shot) and what language code to use.

To style CJK and non-CJK (usually Latin) characters separately, follow the example below:

// Style non-CJK characters
#content {
  font-family: Arial, Verdana; 
  font-size: 12px;
  }

// Style CJK characters
#content:lang(zh-HK) {
  font-family: "Microsoft JhengHei", "MingLiu"; 
  font-size: 14px;
  }

For more information on styling with language codes, check out this reference from W3C.

For advanced users: to auto-detect and <span>-wrap your custom strings in templates, use the following function:

string cjk_autotagger( string $string [, string $lang_code ] )

Example:

echo cjk_autotagger($str, "zh-HK");