diff options
Diffstat (limited to 'exampleSite')
-rw-r--r-- | exampleSite/config.toml | 4 | ||||
-rw-r--r-- | exampleSite/content/posts/theme-documentation-basics.en.md | 24 | ||||
-rw-r--r-- | exampleSite/content/posts/theme-documentation-basics.fr.md | 24 | ||||
-rw-r--r-- | exampleSite/content/posts/theme-documentation-basics.zh-cn.md | 26 |
4 files changed, 48 insertions, 30 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index c1fd9db..d85f048 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,6 +1,6 @@ baseURL = "https://example.com" -# [en, zh-cn, fr, ...] determines default content language -# [en, zh-cn, fr, ...] 设置默认的语言 +# [en, zh-cn, fr, pl, ...] determines default content language +# [en, zh-cn, fr, pl, ...] 设置默认的语言 defaultContentLanguage = "en" # theme # 主题 diff --git a/exampleSite/content/posts/theme-documentation-basics.en.md b/exampleSite/content/posts/theme-documentation-basics.en.md index 317b4cf..52a3dac 100644 --- a/exampleSite/content/posts/theme-documentation-basics.en.md +++ b/exampleSite/content/posts/theme-documentation-basics.en.md @@ -633,23 +633,29 @@ In `config/css/_custom.scss`, you can add some css style code to customize the s ## 4 Multilingual and i18n -**LoveIt** theme is fully compatible with Hugo multilingual mode. +**LoveIt** theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching. -It provides: +![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") -* Translation strings for default values (**English**, **Chinese** and **French**). **Feel free to contribute!** -* In-browser language switching +### 4.1 Compatibility {#language-compatibility} -![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") +| Language | Hugo Code | HTML `lang` Attribute | Theme Docs | Lunr.js Support | +|:------------------ |:---------:|:---------------------:|:-----------------------:|:-----------------------:| +| English | `en` | `en` | :(far fa-check-square): | :(far fa-check-square): | +| Simplified Chinese | `zh-cn` | `zh-CN` | :(far fa-check-square): | :(far fa-check-square): | +| French | `fr` | `fr` | :(far fa-square): | :(far fa-check-square): | +| Polish | `pl` | `pl` | :(far fa-square): | :(far fa-square): | -### 4.1 Basic Configuration +:(far fa-kiss-wink-heart): **Feel free to [contribute](https://github.com/dillonzq/LoveIt/pulls)!** + +### 4.2 Basic Configuration After learning [how Hugo handle multilingual websites](https://gohugo.io/content-management/multilingual), define your languages in your [site configuration](#site-configuration). For example with English, Chinese and French website: ```toml -# [en, zh-cn, fr, ...] determines default content language +# [en, zh-cn, fr, pl, ...] determines default content language defaultContentLanguage = "en" [languages] @@ -754,9 +760,9 @@ Be aware that only translated pages are displayed in menu. It’s not replaced w Use [Front Matter parameter](https://gohugo.io/content-management/multilingual/#translate-your-content) to translate urls too. {{< /admonition >}} -### 4.2 Overwrite Translation Strings +### 4.3 Overwrite Translation Strings -Translations strings are used for common default values used in the theme. Translations are available in **English**, **Chinese** and **French**, but you may use another language or want to override default values. +Translations strings are used for common default values used in the theme. Translations are available in [some languages](#language-compatibility), but you may use another language or want to override default values. To override these values, create a new file in your local i18n folder `i18n/<languageCode>.toml` and inspire yourself from `themes/LoveIt/i18n/en.toml`. diff --git a/exampleSite/content/posts/theme-documentation-basics.fr.md b/exampleSite/content/posts/theme-documentation-basics.fr.md index 7d2bbbb..3fbaadf 100644 --- a/exampleSite/content/posts/theme-documentation-basics.fr.md +++ b/exampleSite/content/posts/theme-documentation-basics.fr.md @@ -638,23 +638,29 @@ In `config/css/_custom.scss`, you can add some css style code to customize the s ## 4 Multilingual and i18n -**LoveIt** theme is fully compatible with Hugo multilingual mode. +**LoveIt** theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching. -It provides: +![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") -* Translation strings for default values (**English**, **Chinese** and **French**). **Feel free to contribute!** -* In-browser language switching +### 4.1 Compatibility {#language-compatibility} -![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") +| Language | Hugo Code | HTML `lang` Attribute | Theme Docs | Lunr.js Support | +|:------------------ |:---------:|:---------------------:|:-----------------------:|:-----------------------:| +| English | `en` | `en` | :(far fa-check-square): | :(far fa-check-square): | +| Simplified Chinese | `zh-cn` | `zh-CN` | :(far fa-check-square): | :(far fa-check-square): | +| French | `fr` | `fr` | :(far fa-square): | :(far fa-check-square): | +| Polish | `pl` | `pl` | :(far fa-square): | :(far fa-square): | -### 4.1 Basic Configuration +:(far fa-kiss-wink-heart): **Feel free to [contribute](https://github.com/dillonzq/LoveIt/pulls)!** + +### 4.2 Basic Configuration After learning [how Hugo handle multilingual websites](https://gohugo.io/content-management/multilingual), define your languages in your [site configuration](#site-configuration). For example with English, Chinese and French website: ```toml -# [en, zh-cn, fr, ...] determines default content language +# [en, zh-cn, fr, pl, ...] determines default content language defaultContentLanguage = "en" [languages] @@ -759,9 +765,9 @@ Be aware that only translated pages are displayed in menu. It’s not replaced w Use [Front Matter parameter](https://gohugo.io/content-management/multilingual/#translate-your-content) to translate urls too. {{< /admonition >}} -### 4.2 Overwrite Translation Strings +### 4.3 Overwrite Translation Strings -Translations strings are used for common default values used in the theme. Translations are available in **English**, **Chinese** and **French**, but you may use another language or want to override default values. +Translations strings are used for common default values used in the theme. Translations are available in [some languages](#language-compatibility), but you may use another language or want to override default values. To override these values, create a new file in your local i18n folder `i18n/<languageCode>.toml` and inspire yourself from `themes/LoveIt/i18n/en.toml`. diff --git a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md index d650424..17359ff 100644 --- a/exampleSite/content/posts/theme-documentation-basics.zh-cn.md +++ b/exampleSite/content/posts/theme-documentation-basics.zh-cn.md @@ -635,23 +635,29 @@ $code-font-family: Fira Mono, Source Code Pro, Menlo, Consolas, Monaco, monospac ## 4 多语言和 i18n -**LoveIt** 主题完全兼容 Hugo 的多语言模式. +**LoveIt** 主题完全兼容 Hugo 的多语言模式, 并且支持在网页上切换语言. -支持: +![语言切换](/images/theme-documentation-basics/language-switch.gif "语言切换") -* 多种语言的翻译字符串 (**英语**, **中文**和**法语**). **欢迎贡献!** -* 在浏览器内语言切换 +### 4.1 兼容性 {#language-compatibility} -![语言切换](/images/theme-documentation-basics/language-switch.gif "语言切换") +| 语言 | Hugo 代码 | HTML `lang` 属性 | 主题文档 | Lunr.js 支持 | +|:---- |:----:|:----:|:----:|:----:| +| 英语 | `en` | `en` | :(far fa-check-square): | :(far fa-check-square): | +| 简体中文 | `zh-cn` | `zh-CN` | :(far fa-check-square): | :(far fa-check-square): | +| 法语 | `fr` | `fr` | :(far fa-square): | :(far fa-check-square): | +| 波兰语 | `pl` | `pl` | :(far fa-square): | :(far fa-square): | -### 4.1 基本配置 +:(far fa-kiss-wink-heart): **请自由地[贡献代码](https://github.com/dillonzq/LoveIt/pulls)!** + +### 4.2 基本配置 学习了 [Hugo如何处理多语言网站](https://gohugo.io/content-management/multilingual) 之后, 请在 [站点配置](#site-configuration) 中定义你的网站语言. 例如, 一个支持英语, 中文和法语的网站配置: ```toml -# [en, zh-cn, fr, ...] 设置默认的语言 +# [en, zh-cn, fr, pl, ...] 设置默认的语言 defaultContentLanguage = "zh-cn" [languages] @@ -756,12 +762,12 @@ defaultContentLanguage = "zh-cn" 也可以使用 [文章前置参数](https://gohugo.io/content-management/multilingual/#translate-your-content) 来翻译网址. {{< /admonition >}} -### 4.2 修改默认的翻译字符串 +### 4.3 修改默认的翻译字符串 翻译字符串用于在主题中使用的常见默认值. -目前提供**英语**, **中文**和**法语**翻译, 但你可能自定义其他语言或覆盖默认值. +目前提供[一些语言](#language-compatibility)的翻译, 但你可能自定义其他语言或覆盖默认值. -要覆盖默认值, 请在项目的 i18n 目录 `i18n/<languageCode>.toml` 中创建一个新文件,并从 `themes/LoveIt/i18n/en.toml` 中获得提示. +要覆盖默认值, 请在你项目的 i18n 目录 `i18n/<languageCode>.toml` 中创建一个新文件,并从 `themes/LoveIt/i18n/en.toml` 中获得提示. 另外, 由于你的翻译可能会帮助到其他人, 请花点时间通过 [创建一个 PR](https://github.com/dillonzq/LoveIt/pulls) 来贡献主题翻译, 谢谢! |