Browse Source

Update docs about trans

index-subcmd
Vincent Prouillet 6 years ago
parent
commit
f3b1553a26
3 changed files with 17 additions and 2 deletions
  1. +3
    -0
      CHANGELOG.md
  2. +5
    -1
      docs/content/documentation/getting-started/configuration.md
  3. +9
    -1
      docs/content/documentation/templates/overview.md

+ 3
- 0
CHANGELOG.md View File

@@ -6,6 +6,7 @@
- Change names of individual taxonomies to be plural (ie `tags/my-tag` instead of `tag/my-tag`)
- Front matter now uses TOML dates rather strings: remove quotes from your date value to fix it.
For example: `date = "2001-10-10"` becomes `date = 2001-10-10`
- `language_code` has been renamed `default_language` in preparations of i18n support

### Others
- Add `get_taxonomy_url` to retrieve the permalink of a tag/category
@@ -16,6 +17,8 @@ For example: `date = "2001-10-10"` becomes `date = 2001-10-10`
- Add Prolog syntax highlighting and update all current syntaxes
- Live reloading now works on shortcode template changes
- `gutenberg serve` now reloads site on `config.toml` changes: you will need to F5 to see them though
- Add a `trans` global function that will get return the translation of the given key for the given lang, defaulting
to `config.default_language` if not given

## 0.2.2 (2017-11-01)



+ 5
- 1
docs/content/documentation/getting-started/configuration.md View File

@@ -21,7 +21,8 @@ base_url = "mywebsite.com"
# Used in RSS by default
title = ""
description = ""
language_code = "en"
# the default language, used in RSS and coming i18n
default_language = "en"

# Theme name to use
theme = ""
@@ -50,6 +51,9 @@ generate_categories_pages = false
# Whether to compile the Sass files found in the `sass` directory
compile_sass = false

# Optional translation object. The key if present should be a language code
[translations]

# You can put any kind of data in there and it
# will be accessible in all templates
[extra]


+ 9
- 1
docs/content/documentation/templates/overview.md View File

@@ -81,7 +81,7 @@ In the case of non-internal links, you can also add a cachebust of the format `?
by passing `cachebust=true` to the `get_url` function.


### ` get_taxonomy_url`
### `get_taxonomy_url`
Gets the permalink for the tag or category given.

```jinja2
@@ -90,3 +90,11 @@ Gets the permalink for the tag or category given.

The `name` will almost come from a variable but in case you want to do it manually,
the value should be the same as the one in the front-matter, not the slugified version.

### `trans`
Gets the translation of the given `key`, for the `default_language` or the `language given

```jinja2
{{ trans(key="title") }}
{{ trans(key="title", lang="fr") }}
```

Loading…
Cancel
Save