From 6112b510bfc0d6b0638d45c7541aac4c9ae5d9d2 Mon Sep 17 00:00:00 2001 From: Dillon Date: Thu, 16 Apr 2020 18:31:06 +0800 Subject: [PATCH] chore(i18n): update Polish and docs (#234) --- README.md | 14 ++++++- README.zh-cn.md | 14 ++++++- exampleSite/config.toml | 4 +- .../posts/theme-documentation-basics.en.md | 26 +++++++----- .../posts/theme-documentation-basics.fr.md | 26 +++++++----- .../posts/theme-documentation-basics.zh-cn.md | 28 ++++++++----- i18n/pl.toml | 42 +++++++++++++++++++ package-lock.json | 6 +-- 8 files changed, 120 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index bec20604..61060adc 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ [![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE) [![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt) -English README | [中文说明](https://github.com/dillonzq/LoveIt/blob/master/README.zh-cn.md) +English README | [简体中文说明](https://github.com/dillonzq/LoveIt/blob/master/README.zh-cn.md) -**LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/). +> **LoveIt** is a **clean**, **elegant** but **advanced** blog theme for [Hugo](https://gohugo.io/). It is based on the original [LeaveIt Theme](https://github.com/liuzc/LeaveIt/) and [KeepIt Theme](https://github.com/liuzc/LeaveIt/). @@ -117,6 +117,16 @@ I hope you will LoveIt ❤️! hugo server --source=exampleSite ``` +## Multilingual and i18n + +LoveIt supports the following languages: + +* English +* Simplified Chinese +* French +* Polish +* [Contribute with a new language](https://github.com/dillonzq/LoveIt/pulls) + ## Questions, ideas, bugs, pull requests All feedback is welcome! Head over to the [issue tracker](https://github.com/dillonzq/LoveIt/issues). diff --git a/README.zh-cn.md b/README.zh-cn.md index 539806a0..2f6b7ef7 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -5,9 +5,9 @@ [![License](https://img.shields.io/github/license/dillonzq/LoveIt?style=flat-square)](https://github.com/dillonzq/LoveIt/blob/master/LICENSE) [![CircleCI](https://img.shields.io/circleci/build/github/dillonzq/LoveIt/develop?label=CI&style=flat-square&logo=circleci)](https://app.circleci.com/pipelines/github/dillonzq/LoveIt) -[English README](https://github.com/dillonzq/LoveIt/blob/master/README.md) | 中文说明 +[English README](https://github.com/dillonzq/LoveIt/blob/master/README.md) | 简体中文说明 -[LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。 +> [LoveIt](https://github.com/dillonzq/LoveIt) 是一个**简洁**、**优雅**且**高效**的 [Hugo](https://gohugo.io/) 博客主题。 它的原型基于 [LeaveIt 主题](https://github.com/liuzc/LeaveIt/) 和 [KeepIt 主题](https://github.com/liuzc/LeaveIt/)。 @@ -112,6 +112,16 @@ hugo server --source=exampleSite ``` +## 多语言和国际化 + +LoveIt 支持下列语言: + +* 英语 +* 简体中文 +* 法语 +* 波兰语 +* [贡献一种新的语言](https://github.com/dillonzq/LoveIt/pulls) + ## 问题、想法、 bugs 和 PRs 所有的反馈都是欢迎的!详见 [issue tracker](https://github.com/dillonzq/LoveIt/issues)。 diff --git a/exampleSite/config.toml b/exampleSite/config.toml index c1fd9db2..d85f048c 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 317b4cf6..52a3dacd 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. - -It provides: - -* Translation strings for default values (**English**, **Chinese** and **French**). **Feel free to contribute!** -* In-browser language switching +**LoveIt** theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching. ![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") -### 4.1 Basic Configuration +### 4.1 Compatibility {#language-compatibility} + +| 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): | + +:(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/.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 7d2bbbba..3fbaadfe 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. - -It provides: - -* Translation strings for default values (**English**, **Chinese** and **French**). **Feel free to contribute!** -* In-browser language switching +**LoveIt** theme is fully compatible with Hugo multilingual mode, which provides in-browser language switching. ![Language Switch](/images/theme-documentation-basics/language-switch.gif "Language Switch") -### 4.1 Basic Configuration +### 4.1 Compatibility {#language-compatibility} + +| 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): | + +:(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/.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 d650424f..17359ff2 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 基本配置 +### 4.1 兼容性 {#language-compatibility} + +| 语言 | 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): | + +:(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/.toml` 中创建一个新文件,并从 `themes/LoveIt/i18n/en.toml` 中获得提示. +要覆盖默认值, 请在你项目的 i18n 目录 `i18n/.toml` 中创建一个新文件,并从 `themes/LoveIt/i18n/en.toml` 中获得提示. 另外, 由于你的翻译可能会帮助到其他人, 请花点时间通过 [创建一个 PR](https://github.com/dillonzq/LoveIt/pulls) 来贡献主题翻译, 谢谢! diff --git a/i18n/pl.toml b/i18n/pl.toml index 07ab6ef8..3b66112e 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -1,6 +1,14 @@ # Translations for Polish # https://gohugo.io/content-management/multilingual/#translation-of-strings +# === baseof == +[backToTop] +other = "Powrót do góry" + +[viewComments] +other = "Zobacz komentarze" +# === baseof == + # === Post === [posts] other = "Posty" @@ -32,6 +40,21 @@ other = "Więcej" [selectLanguage] other = "Wybierz język" +[search] +other = "Szukaj" + +[searchPlaceholder] +other = "Wyszukaj tytuł lub treść artykułu ..." + +[clear] +other = "Pusty" + +[cancel] +other = "Anuluj" + +[noResultsFound] +other = "Nie znaleziono wyników" + [switchTheme] other = "Przełącz schemat" # === partials/header.html === @@ -44,6 +67,14 @@ other = "Napędzany przez %s" other = "Szablon" # === partials/footer.html === +# === partials/assets.html === +[lunrLanguageLib] +other = "lib/lunr/lunr.pl.js" + +[lunrLanguageCode] +other = "pl" +# === partials/assets.html === + # === partials/plugin/share.html === [shareOn] other = "Udostępnij na" @@ -138,3 +169,14 @@ other = "Przykład" [quote] other = "Cytat" # === shortcodes/admonition.html === + +# === shortcodes/version.html === +[new] +other = "Dodano" + +[changed] +other = "Zmieniono" + +[deleted] +other = "Usunięte" +# === shortcodes/version.html === diff --git a/package-lock.json b/package-lock.json index 4802deb2..e5533eee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2872,9 +2872,9 @@ }, "dependencies": { "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true, "optional": true }