若要讓您的網站以不同語言呈現,您可使用國際化(internationalization)功能。 請先在 _config.yml 中調整 language 設定,這代表的是預設語言,您也可設定多個語言來調整預設語言的順位。 You can also set multiple languages and modify the order of default languages.
language: zh-tw  | 
語言檔案
Language files can be YAML or JSON files. 語言檔案可以 YAML 或 JSON 呈現,並放在主題資料夾中的 languages 資料夾。 您可在語言檔案中使用 printf 格式。
模板
Use __ or _p helpers in templates to get the translated strings. The former is for normal usage and the latter is for plural strings. For example:
index:  | 
<%= __('index.title') %>  | 
路徑
您可在 front-matter 中指定該頁面的語言,也可在 _config.yml 中修改 i18n_dir 設定,讓 Hexo 自動偵測。
i18n_dir: :lang  | 
在模板中,透過 __ 或 _p 輔助函數,即可取得翻譯後的字串,前者用於一般使用;而後者用於複數字串。 例如:
/index.html => en  | 
The string will only be served as a language when the language file exists. 擷取到的字串唯有在語言檔存在的情況下,才會被當作是語言,因此例二 /archives/index.html 中的 archives 就不被當成是語言。