From bd45dd1c367dba05b638802b20f463e4c3b912f8 Mon Sep 17 00:00:00 2001 From: Piotr Machowski Date: Tue, 11 Jun 2024 02:24:17 +0200 Subject: [PATCH] Improve documentation --- README.md | 29 ++++++++++++++++++++--------- hacs.json | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 1984964..7c75739 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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.
@@ -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.
@@ -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.
@@ -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`, ``, `None`. +By default, the following states are treated as not available: `unknown`, `unavailable`, ``, `None`. It is possible to override this list by providing a second argument.
@@ -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) diff --git a/hacs.json b/hacs.json index 3e0e773..1288431 100644 --- a/hacs.json +++ b/hacs.json @@ -3,5 +3,5 @@ "render_readme": true, "zip_release": true, "filename": "custom_templates.zip", - "homeassistant": "2024.2.0b0" + "homeassistant": "2024.5.0b0" } \ No newline at end of file