Han v0.3.0 Han View Source

Utils for processing chinese.

Link to this section Summary

Functions

Public function to convert Chinese words to pinyin. Example

Public function to slugify Chinese words. Example

Public function to translate chinese. Example

Link to this section Functions

Public function to convert Chinese words to pinyin. Example:

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. Example:

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. Example:

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

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

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

translate(content, atom) View Source