Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass entity untranslated state to sentences #1848

Closed
wants to merge 12 commits into from
Closed
35 changes: 35 additions & 0 deletions responses/de/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ responses:
Nein
{% endif %}

einzeln_zone: |
{% if query.matched %}
Ja
{% else %}
Nein, ist
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
im Bereich {{ state.state_with_unit }}
{% endif %}
{% endif %}

irgendeins: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
Expand Down Expand Up @@ -59,5 +71,28 @@ responses:
{% endif %}
{% endif %}

wer: |
{% if not query.matched %}
Niemand
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} und {{ (match | length - 3) }} weitere
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} und {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

wie_viele: |
{{ query.matched | length }}

wo: |
{{ slots.name | capitalize }} ist
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
im Bereich {{ state.state }}
{% endif %}
2 changes: 1 addition & 1 deletion responses/de/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ responses:
'windy': 'und windig',
'windy-variant': 'mit Wind und Wolken'
} %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}
60 changes: 57 additions & 3 deletions responses/en/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ responses:
No, {{ state.state_with_unit }}
{% endif %}

someone_yesno: |
{% if query.matched %}
Yes
{% else %}
No,
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
at {{ state.state }}
{% endif %}
{% endif %}

any: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
Expand Down Expand Up @@ -48,6 +60,32 @@ responses:
{% endif %}
{% endif %}

everybody: |
{% if not query.unmatched: %}
Yes
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
No, {{ no_match[:3] | join(", ") }} and {{ (no_match | length - 3) }} more are not
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
at {{ state.state }}
{% endif %}
{%- else -%}
No,
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} and {% endif -%}
{{ name }}
{%- endfor %} {% if no_match | length > 1 %}are{% else %}is{% endif %} not
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
at {{ state.state }}
{% endif %}
{% endif %}
{% endif %}

which: |
{% if not query.matched %}
Not any
Expand All @@ -63,12 +101,28 @@ responses:
{% endif %}
{% endif %}

who: |
{% if not query.matched %}
Nobody
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} and {{ (match | length - 3) }} others
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} and {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

how_many: |
{{ query.matched | length }}

where: |
{% if state == "not_home" %}
{{ slots.name | capitalize }} is away
{{ slots.name | capitalize }} is
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
{{ slots.name | capitalize }} is at {{ state.state }}
at {{ state.state }}
{% endif %}
2 changes: 1 addition & 1 deletion responses/en/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ responses:
'windy': 'and windy',
'windy-variant': 'with wind and clouds'
} %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}
70 changes: 62 additions & 8 deletions responses/es/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ responses:
{% endif %}
{% endif %}

someone_yesno: |
{% if query.matched %}
{% else %}
No, está
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
en {{ state.state }}
{% endif %}
{% endif %}

any: |
{% if query.matched %}
{% set match = query.matched | map(attribute="name") | sort | list %}
Expand Down Expand Up @@ -54,11 +66,7 @@ responses:
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
{% if state.domain == "person" %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} están en {{slots.state}}
{% else %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} dispositivos tienen ese estado
{% endif %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} dispositivos tienen ese estado
{% else %}
{% if no_match | length == 1 %}
{% if state.domain == "person" %}
Expand All @@ -81,6 +89,36 @@ responses:
{% endif %}
{% endif %}

everybody: |
{% if not query.unmatched: %}
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
No, ni {{ no_match[:3] | join(", ni ") }} ni otros {{ (no_match | length - 3) }} están
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
en {{ state.state }}
{% endif %}
{%- else -%}
{% if no_match | length == 1 %}
No, {{ no_match|first }} no está
{% else %}
No, ni
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, ni {% elif loop.last and not loop.first %} ni {% endif -%}
{{ name }}
{%- endfor %} están
{% endif %}
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
en {{ state.state }}
{% endif %}
{% endif %}
{% endif %}

which: |
{% if not query.matched %}
Ningún dispositivo
Expand All @@ -96,12 +134,28 @@ responses:
{% endif %}
{% endif %}

who: |
{% if not query.matched %}
Nadie
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} y otros {{ (match | length - 3) }} más
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} y {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

how_many: |
{{ query.matched | length }}

where: |
{% if state == "not_home" %}
{{ slots.name | capitalize }} está fuera
{{ slots.name | capitalize }} está
{% if state.attributes.get("untranslated_state") == "not_home" %}
{{ state.state }}
{% else %}
{{ slots.name | capitalize }} está en {{ state.state }}
en {{ state.state }}
{% endif %}
7 changes: 6 additions & 1 deletion responses/es/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ responses:
'windy': 'Vientos',
'windy-variant': 'Vientos y nubes'
} %}
{{ weather_condition.get((state.state | string).lower(), "") }}, con una temperatura de {{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }}
{{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}, con una temperatura de
{% if state.attributes.get('temperature') | int < 0 %}
{{ (state.attributes.get('temperature')|float |abs|string).rstrip('.0') }} {{ state.attributes.get('temperature_unit') }} bajo cero
{% else %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }}
{% endif %}
61 changes: 52 additions & 9 deletions responses/nl/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ responses:
Nee, die is {{ state.state_with_unit }}
{% endif %}

one_zone: |
someone_yesno: |
{% if query.matched %}
Ja
{% elif state.state == 'not_home' %}
Nee, die is niet thuis
{% else %}
Nee, die is in de zone {{ state.state_with_unit }}
Nee,
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
in zone {{ state.state }}
{% endif %}
{% endif %}

bs_yesno: |
Expand Down Expand Up @@ -62,6 +65,32 @@ responses:
{% endif %}
{% endif %}

everybody: |
{% if not query.unmatched: %}
Ja
{% else %}
{% set no_match = query.unmatched | map(attribute="name") | sort | list %}
{% if no_match | length > 4 %}
Nee, {{ no_match[:3] | join(", ") }} en nog {{ (no_match | length - 3) }} personen zijn niet
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
in zone {{ state.state }}
{% endif %}
{%- else -%}
Nee,
{% for name in no_match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} en {% endif -%}
{{ name }}
{%- endfor %} {% if no_match | length > 1 %}zijn{% else %}is{% endif %} niet
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
in zone {{ state.state }}
{% endif %}
{% endif %}
{% endif %}

which: |
{% if not query.matched %}
Geen
Expand All @@ -77,14 +106,28 @@ responses:
{% endif %}
{% endif %}

who: |
{% if not query.matched %}
Niemand
{% else: %}
{% set match = query.matched | map(attribute="name") | sort | list %}
{% if match | length > 4 %}
{{ match[:3] | join(", ") }} en {{ (match | length - 3) }} anderen
{% else %}
{%- for name in match -%}
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} en {% endif -%}
{{ name }}
{%- endfor -%}
{% endif %}
{% endif %}

how_many: |
{{ query.matched | length }}

where: |
{% if state.state == "not_home" %}
{{ slots.name | capitalize }} is niet thuis
{% elif state.state == "home" %}
{{ slots.name | capitalize }} is thuis
{{ slots.name | capitalize }} is
{% if state.attributes.get("untranslated_state") in ["not_home", "home"] %}
{{ state.state }}
{% else %}
{{ slots.name | capitalize }} is in zone {{ state.state }}
in zone {{ state.state }}
{% endif %}
2 changes: 1 addition & 1 deletion responses/nl/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ responses:
'windy': 'met wind',
'windy-variant': 'met wind en bewolking'
} %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.attributes.get('untranslated_state') | string).lower(), "") }}
Loading