Skip to content
This repository has been archived by the owner on Feb 16, 2019. It is now read-only.

caiguanhao/jquery-hanzi2pinyin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery hanzi2pinyin

fast hanzi to pinyin conversion

Demo, where you can customize hanzi2pinyin

Versions

jquery-hanzi2pinyin.all.js (~102KB)

contains simplified and traditional Chinese characters and pinyins with tones.

jquery-hanzi2pinyin.simp.js (~24KB)

contains only simplified Chinese characters and pinyins without tones (suitable for users in mainland China).

Examples

DOM

// Hanzi in $('#hanzi') will convert to pinyin and put to $('#pinyin')
$('#hanzi').hanzi2pinyin({target:'#pinyin'});

String

// This brings the same effect as above:
$('#pinyin').val($('#hanzi').val().hanzi2pinyin());

// HanZi
alert('汉字'.hanzi2pinyin({'case':'proper',hyphen:''}));

Options

target

selectors which will contain the results

hyphen

the hyphens between pinyins

'case'

can be lower, upper or proper (title) case

(Note: adding quotes around case is necessary for IE browsers)

punctuation_marks

you can remove, ignore the Chinese punctuation marks or replace them with corresponding English punctuation marks (?)

fullwidth_chars

you can remove, ignore the fullwidth characters or replace them with corresponding halfwidth characters (?)

tones

displays tones in simple (han-zi), standard (hàn-zì) or numeric (han4-zi4) mode

Releases

No releases published

Packages

No packages published