Ruby gems for language translations
Tradsim
is useful for translation between Traditional Chinese and Simplified Chinese.
# traditional to simplified chinese translation
Tradsim::to_sim("轉街過巷 就如滑過浪潮 聽天說地 仍然剩我心跳") => "转街过巷 就如滑过浪潮 听天说地 仍然剩我心跳"
# simplified to traditional chinese translation
Tradsim::to_trad("转街过巷 就如滑过浪潮 听天说地 仍然剩我心跳") => "轉街過巷 就如滑過浪潮 聽天說地 仍然剩我心跳"
# guess whether text is traditional, simplified or unknown
Tradsim::guess("轉街過巷 就如滑過浪潮 聽天說地 仍然剩我心跳") => :traditional
script_detector
Library for detecting if string is traditional Chinese, simplified Chinese, Japanese or Korean
string = "我的氣墊船充滿了鱔魚."
string.chinese? => true
string.japanese? => false
Note: Tradsim only work in UTF-8 encoding, put following at the beginning of the ruby code.
# encoding: UTF-8
or
#!/usr/bin/env ruby -wKU
Check out the these gems: Tradsim, Script detector