Han (Han v0.3.4) View Source

Utils for processing chinese.

Link to this section Summary

Functions

Public function to convert chinese words to pinyin.

Public function to slugify chinese words.

Public function to translate chinese.

Link to this section Functions

Public function to convert chinese words to pinyin.

Examples

iex> Han.pinyin("中国")
"zhōng guó"

iex> Han.pinyin("中国", :simplified)
"zhōng guó"

iex> Han.pinyin("中國", :traditional)
"zhōng guó"

Public function to slugify chinese words.

Examples

iex> Han.slugify("中国")
"zhong-guo"

iex> Han.slugify("中國", :traditional)
"zhong-guo"

iex> Han.slugify(" *& 46 848 中 ----- 国")
"46-848-zhong-guo"

iex> Han.slugify("关于 Elixir 的 HTML5 页面")
"guan-yu-elixir-de-html5-ye-mian"

Public function to translate chinese.

Examples

iex> Han.translate("中国")
"中國"

iex> Han.translate("中国", :simplified)
"中國"

iex> Han.translate("中國", :traditional)
"中国"
Link to this function

translate(content, atom)

View Source