Translate chinese hanzi to pinyin.
A RubyMotion wrapper for (https://github.com/flyerhzm/chinese_pinyin).
Add this line to your application's Gemfile:
gem 'motion-pinyin'
And then execute:
$ bundle
Pinyin.t('**') => "zhong guo"
Pinyin.t('你好world') => "ni hao world"
Pinyin.t('**', splitter: '-') => "zhong-guo"
Pinyin.t('**', splitter: '') => "zhongguo"
Pinyin.t('**', tone: true) => "zhong1 guo2"
use Words.dat to override default behavior.
by default
Pinyin.t('广州') => "yan zhou"
add file Words.dat
广州|guang3 zhou1
set ENV['WORDS_FILE'] for Words.dat
ENV['WORDS_FILE'] = "Words.dat path"
Pinyin.t('广州') => "guang zhou"