国际化

Hugo 搜索模块支持的语言列表,以及介绍如何添加新语言。

支持的语言

LanguageCode
Germande
Englishen
Frenchfr
Koreanko
Malayms
Dutchnl
Brazilian Portuguesept-br
Russianru
Simplified Chinesezh-hans
Traditional Chinesezh-hant

如何添加新语言?

The translations are stored in the data/search/i18n folder, it’s different from Hugo i18n, since the module using JS instead of templates to render the HTML markup.

  1. Fork and clone the repository.
  2. Copy the data/search/i18n/en.toml and naming it with language code, i.e. fr.toml, ru.toml.
  3. Translate the items.
  4. Create a pull request.

自定义国际化翻译

Let’s take the input_placeholder as an example, just create the corresponding translations file under your project’s root.

1# data/search/i18n/en.toml
2[input_placeholder]
3other = "SEARCH INPUT PLACEHOLDER"

Now, the input_placeholder will be SEARCH INPUT PLACEHOLDER in en sites.

All the available translations’ keys can be found at data/search/i18n folder.