diff options
author | Thibaud Leprêtre <thibaud.lepretre@gmail.com> | 2016-11-15 00:59:07 +0300 |
---|---|---|
committer | Thibaud Leprêtre <thibaud.lepretre@gmail.com> | 2016-11-20 17:21:07 +0300 |
commit | 4567ee757caf6133eaa6f026308385fcaba19508 (patch) | |
tree | 31e2e529860362b32dc3e8973f6b6dd875ddc31e /docs | |
parent | 97054739a2523dcecac4ca43c151b4140d0b8783 (diff) |
Add theme translation
- [x] replace hardcoded string by `{{ i18n KEY }}` in html file
- [x] Add *en-US* translation file
- [x] Add *fr-FR* translation file
- [x] Add *es-ES* translation file
- [x] Add *ja* translation file
- [x] Add *pt-br* translation file
- [x] Add *ru* translation file
- [x] Add *zh-cn* translation file
- [x] Add *zh-tw* translation file
- [x] Add *vi* translation file
- [x] Add *de-de* translation file
- [x] translate menu
- [x] localize date (if possible)
fixes #9
Diffstat (limited to 'docs')
-rw-r--r-- | docs/user.md | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/docs/user.md b/docs/user.md index 94a97d8..e8c7414 100644 --- a/docs/user.md +++ b/docs/user.md @@ -18,7 +18,11 @@ If you want to report a bug or ask a question, [create an issue](https://github. - [Requirements](#requirements) - [Installation](#installation) - [Tranquilpeak configuration](#tranquilpeak-configuration) + - [Language configuration](#language-configuration) + * [Menu translation](#menu-translation) - [Theme configuration](#theme-configuration) + * [Define date format](#define-date-format) + * [Define global keywords](#define-global-keywords) * [Sidebar](#sidebar) * [Header](#header) * [Author](#author) @@ -63,6 +67,7 @@ If you want to report a bug or ask a question, [create an issue](https://github. - Beautiful about page - Support Open Graph protocol - Easily customizable (fonts, colors, layout elements, code coloration, etc..) +- Support internationalization (i18) **Posts features:** @@ -85,11 +90,9 @@ If you want to report a bug or ask a question, [create an issue](https://github. ### Missing features from original *Hexo* version -- [ ] Support internationalization (i18) (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/9) - [ ] Duoshuo - [ ] Baidu analytics - [ ] Algolia (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/8) -- [ ] Documentations (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/4) - [ ] Pagination custumization `tag_pagination`, `category_pagination` and `archive_pagination` (https://github.com/kakawait/hugo-tranquilpeak-theme/issues/17) **ATTENTION** following features will not be possible due to *Hugo* limitations @@ -116,10 +119,69 @@ git clone https://github.com/kakawait/hugo-tranquilpeak-theme.git If it's your first time using Hugo, please check [Hugo official documentation](https://gohugo.io/overview/introduction/) +### Language configuration + +Simply edit following value in `config.{toml,yaml,json}`: + +```toml +defaultContentLanguage = "en-us" +``` + +by one of the following code (code is between `()`): + +- Chinese (`zh-cn`) +- Chinese Traditional (`zh-tw`) +- English (`en-us`) +- Deutsch (`de-de`) +- French (`fr-fr`) +- Japanase (`ja`) +- Portuguese (`pt-br`) +- Russian (`ru`) +- Spanish (`es`) +- Vietnamese (`vi`) + +If your language is not available, follow this guidelines (E.g : add swedish language (`sv-se`)) : + +1. Set `defaultContentLanguage` to `sv-se` in Hugo configuration file `config.{toml,yaml,json}` +2. Create `sv-se.yaml` file in `theme/tranquilpeak/i18n/` folder +3. Copy the content of `theme/tranquilpeak/i18n/en.yaml` and paste it to `sv-se.yml` file +4. Replace all strings in english by their translation in swedish + +#### Menu translation + +Menus are defined using Hugo menus https://gohugo.io/extras/menus/ + +You can translate menu entries by setting `identifier` that matches a translation key. By using this way, `name` will not be use at all. + ### Setting up default theme to Tranquilpeak Modify the theme in `config.{toml,yml,json}` by changing `theme` variable to `tranquilpeak` +### Define date format + +By default date will be printed like following: `mmmm d, yyyy`, example: "January 1, 2006" + +You can customize it by setting + +```toml +[params] + dateFormat = "1 January 2006" +``` + +Will produce: "1 January 2006" + +ATTENTION: date format should respect `go` `Time` package syntax, please refer to https://golang.org/pkg/time/ + +**Moreover, if you are using fully named month (short named month like "jan", "feb", etc is not supported), month will be translated.** + +Example: + +```toml +defaultContentLanguage = "fr-fr" +``` + +"1 January 2006" will be output "1 Janvier 2006". + ### Define global keywords You can define keywords for search engines. These keywords will be added on all pages. @@ -219,6 +281,8 @@ You can add groups of links and links much as you want. | url | menu entry url | string | | class | CSS Class added to the `a` link tag | string | +`identifier` can be use for translation see [Menu translation](#menu-translation). + #### Header The right link of the header is customizable. You can add a link (as an icon) at the right of the header instead of the author's gravatar image or author's picture. By default, author's gravatar or author's picture is displayed. |