You can use internationalization to present your site in different languages. The default language is set by modifying the
language setting in
_config.yml. You can also set multiple languages and modify the order of default languages.
Language files can be YAML or JSON files. You should put them into the
languages folder in the theme. There is support for the printf format in language files.
_p helpers in templates to get the translated strings. The former is for normal usage and the latter is for plural strings. For example:
You can set the language of pages in front-matter, or modify the
i18n_dir setting in
_config.yml to enable automatic detection by Hexo.
The default value of
i18n_dir setting is
:lang, which means that Hexo will detect the language within the first segment of URL. For example:
The string will only be served as a language when the language file exists. So
/archives/index.html (example 2) will not get served as a language.