Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrMachowski committed Jun 11, 2024
1 parent 6406b30 commit bd45dd1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ This integration adds possibility to use new functions in Home Assistant Jinja2
### `ct_state_translated`

This function returns translated state of an entity.
Second parameter (language) is optional - it defaults to the language configured in Home Assistant.

<table>
<tr>
Expand Down Expand Up @@ -86,6 +87,7 @@ Translated nl: Onder de horizon
### `ct_state_attr_translated`

This function returns translated value of an attribute of an entity.
Third parameter (language) is optional - it defaults to the language configured in Home Assistant.

<table>
<tr>
Expand Down Expand Up @@ -125,6 +127,7 @@ Translated nl: Enkelvoudig
### `ct_translated`

This function returns translation for a given key. You can use `ct_all_translations` to check available keys.
Second parameter (language) is optional - it defaults to the language configured in Home Assistant.

<table>
<tr>
Expand Down Expand Up @@ -162,6 +165,7 @@ Translated nl: Onder de horizon
### `ct_all_translations`

This function returns all available translations.
Parameter (language) is optional - it defaults to the language configured in Home Assistant.

<table>
<tr>
Expand Down Expand Up @@ -230,7 +234,7 @@ below_horizon
### `ct_is_available`

This function checks if given entity has an available state.
By default the following states are treated as not available: `unknown`, `unavailable`, `<empty_text>`, `None`.
By default, the following states are treated as not available: `unknown`, `unavailable`, `<empty_text>`, `None`.
It is possible to override this list by providing a second argument.

<table>
Expand Down Expand Up @@ -312,20 +316,27 @@ Output

To use this integration you have to add following config in `configuration.yaml`:

```yaml
custom_templates:
preload_translations:
- en
- nl
```
* Without additional languages:
```yaml
custom_templates:
```
* With additional languages:
```yaml
custom_templates:
preload_translations:
- en
- nl
```
A list of available language tags is available [here](https://github.com/home-assistant/core/blob/master/homeassistant/generated/languages.py), a list of desriptions of language tags is available [here](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).
A list of available language tags is available [here](https://github.com/home-assistant/core/blob/master/homeassistant/generated/languages.py), a list of descriptions of language tags is available [here](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry).
Section `preload_translations` should contain a list of languages you want to use with translations-related functions.
If it is not provided only a language provided in HA config will be loaded.

## Installation

Since version v1.3.0 the minimal supported version of Home Assistant is 2024.2.0.
Since version v1.4.0 the minimal supported version of Home Assistant is 2024.5.0.

### Using [HACS](https://hacs.xyz/) (recommended)

Expand Down
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"render_readme": true,
"zip_release": true,
"filename": "custom_templates.zip",
"homeassistant": "2024.2.0b0"
"homeassistant": "2024.5.0b0"
}

0 comments on commit bd45dd1

Please sign in to comment.