On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5) by justyy

View this thread on steempeak.com
· @justyy · (edited)
$93.52
On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5)
[Simplified/Traditional Chinese](https://helloacm.com/on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5/) is a chrome Extension that allows you to convert from ZH-CN (GB2312) to ZH-TW(BIG5) and vice versa.

Chrome Webstore: [Simplified/Traditional Chinese](https://chrome.google.com/webstore/detail/%E7%AE%80%E4%BD%93%E7%B9%81%E4%BD%93%E8%BD%AC%E6%8D%A2-simplifiedtraditio/olpihmabpjpllgmahlgiakkgaccigpfo)

I developed this tool because I feel more conformable in reading [Simplified Chinese](https://helloacm.com/chrome-extension-to-switch-between-simplified-chinese-and-traditional-chinese-automatically/) and I believe some others prefer the Traditional Chinese.

Today, I have added a feature to convert Chinese characters (either in Simplified or Traditional Chinese) to Pinyin, which is used to pronounce the character characters.

# UI Change
![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1517187905/wuozrsjqmdrbqimvqwww.png)

# How it works
For example, refresh the page, will convert the following:

![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1517187961/yzgwi8qqojjw2fo3ycqt.png)

 to:

![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1517187979/vtjjj8jszoddw2tyzjqo.png)

# Technology Stack
Chrome Extension, Javascript.

# Commits
Github: https://github.com/DoctorLai/Simplified-and-Traditional-Chinese
[This commit](https://github.com/DoctorLai/Simplified-and-Traditional-Chinese/commit/ef185683de46c9e3ea597b4e877ef0bf9481c066#diff-bf5d8bd496c5783a45bd13aec64829eb) with some code formatting. 

```
let testChinese = (cc, i) => {
	return (cc.charCodeAt(i) > 10000);
}

function Pinyin(cc) {	
	let str = '';
	for (let i = 0; i < cc.length; ++ i) {
		if (testChinese(cc, i)) {
			if (cc[i] in pinyin_data) {
				let ts = pinyin_data[cc[i]];
				ts = ts.split(',')[0].slice(0, -1);
				str += ts[0].toUpperCase();
				str += ts.substring(1);
				str += " ";
			} else {
				str += cc[i];
			}
		} else {
  			str += cc[i];
  		}
	}
	return str.trim();
}
```


<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@justyy/on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 31 others
properties (23)
post_id28,817,674
authorjustyy
permlinkon-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5
categoryutopian-io
json_metadata"{"type": "development", "repository": {"owner": {"login": "DoctorLai"}, "id": 99736743, "full_name": "DoctorLai/Simplified-and-Traditional-Chinese", "fork": false, "name": "Simplified-and-Traditional-Chinese", "html_url": "https://github.com/DoctorLai/Simplified-and-Traditional-Chinese"}, "pullRequests": [], "format": "markdown", "image": ["https://res.cloudinary.com/hpiynhbhq/image/upload/v1517187905/wuozrsjqmdrbqimvqwww.png"], "links": ["https://helloacm.com/on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5/", "https://chrome.google.com/webstore/detail/%E7%AE%80%E4%BD%93%E7%B9%81%E4%BD%93%E8%BD%AC%E6%8D%A2-simplifiedtraditio/olpihmabpjpllgmahlgiakkgaccigpfo", "https://helloacm.com/chrome-extension-to-switch-between-simplified-chinese-and-traditional-chinese-automatically/", "https://github.com/DoctorLai/Simplified-and-Traditional-Chinese", "https://github.com/DoctorLai/Simplified-and-Traditional-Chinese/commit/ef185683de46c9e3ea597b4e877ef0bf9481c066#diff-bf5d8bd496c5783a45bd13aec64829eb", "https://utopian.io/utopian-io/@justyy/on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5"], "platform": "github", "moderator": {"pending": false, "account": "codingdefined", "reviewed": true, "flagged": false, "time": "2018-01-29T04:33:44.875Z"}, "app": "steemit/0.1", "tags": ["utopian-io", "chrome-extension", "chinese", "cn", "programming"], "community": "utopian"}"
created2018-01-29 01:09:54
last_update2018-01-30 10:04:03
depth0
children4
net_rshares14,770,912,794,739
last_payout2018-02-05 01:09:54
cashout_time1969-12-31 23:59:59
total_payout_value67.976 SBD
curator_payout_value25.544 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length2,269
author_reputation2,057,469,156,047,835
root_title"On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5)"
beneficiaries
0.
accountutopian.pay
weight2,500
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (95)
@aress ·
![tbl92gx.gif](https://steemitimages.com/DQma26jSq5SVpf8tUu6NsMSqZ316H4fyTdQSaoq6vtyTGN2/tbl92gx.gif)
properties (22)
post_id28,818,012
authoraress
permlinkre-justyy-on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5-20180129t011151733z
categoryutopian-io
json_metadata"{"app": "steemit/0.1", "image": ["https://steemitimages.com/DQma26jSq5SVpf8tUu6NsMSqZ316H4fyTdQSaoq6vtyTGN2/tbl92gx.gif"], "tags": ["utopian-io"]}"
created2018-01-29 01:11:54
last_update2018-01-29 01:11:54
depth1
children0
net_rshares0
last_payout2018-02-05 01:11:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length101
author_reputation211,078,716,370
root_title"On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@syaisyah ·
great job, raeally great idea for an app ...
Greetings from me @justyy
properties (22)
post_id28,818,259
authorsyaisyah
permlinkre-justyy-on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5-20180129t011327124z
categoryutopian-io
json_metadata"{"app": "steemit/0.1", "users": ["justyy"], "tags": ["utopian-io"]}"
created2018-01-29 01:13:33
last_update2018-01-29 01:13:33
depth1
children0
net_rshares0
last_payout2018-02-05 01:13:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length70
author_reputation16,426,897,814
root_title"On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@codingdefined ·
Thank you for the contribution. It has been approved.

You can contact us on [Discord](https://discord.gg/uTyJkNm).
**[[utopian-moderator]](https://utopian.io/moderators)**
properties (22)
post_id28,851,156
authorcodingdefined
permlinkre-justyy-on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5-20180129t043350761z
categoryutopian-io
json_metadata"{"app": "utopian/1.0.0", "community": "utopian", "tags": ["utopian-io"]}"
created2018-01-29 04:33:51
last_update2018-01-29 04:33:51
depth1
children0
net_rshares0
last_payout2018-02-05 04:33:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length172
author_reputation71,157,752,447,147
root_title"On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@utopian-io ·
### Hey @justyy I am @utopian-io. I have just upvoted you!
#### Achievements
- WOW WOW WOW People loved what you did here. GREAT JOB!
- Seems like you contribute quite often. AMAZING!
#### Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a>
- Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a>

[![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses)

**Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
properties (22)
post_id29,019,762
authorutopian-io
permlinkre-justyy-on-the-fly-conversion-to-pinyin-using-chrome-extension-zh-cn-gb2312-zh-tw-big5-20180129t210833410z
categoryutopian-io
json_metadata"{"app": "utopian/1.0.0", "community": "utopian", "tags": ["utopian-io"]}"
created2018-01-29 21:08:33
last_update2018-01-29 21:08:33
depth1
children0
net_rshares0
last_payout2018-02-05 21:08:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,061
author_reputation152,913,012,544,965
root_title"On-the-fly Conversion to Pinyin using Chrome Extension: ZH-CN (GB2312) <---> ZH-TW (BIG5)"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000