Debian Codegraph @

intents/responses/cs/HassTimerStatus.yaml

raw
1 ---
2 language: cs
3 responses:
4 intents:
5 HassTimerStatus:
6 default: |
7 {% macro pluralize_flexed(number, flexes) %}
8 {% if (number|string)[-1] in ["1"]: %}
9 {{ number }} {{ flexes[0] }}
10 {% elif (number|string)[-1] in ["2", "3", "4"]: %}
11 {{ number }} {{ flexes[1] }}
12 {% elif (number|string)[-1] in ["5", "6", "7", "8", "9"]: %}
13 {{ number }} {{ flexes[2] }}
14 {% else %}
15 {% endif %}
16 {% endmacro %}
17 {% set hours_flexed = ['hodina', 'hodiny', 'hodin'] %}
18 {% set minutes_flexed = ['minuta', 'minuty', 'minut'] %}
19 {% set seconds_flexed = ['sekunda', 'sekundy', 'sekund'] %}
20 {% set hours_start_flexed = ['hodinu', 'hodiny', 'hodin'] %}
21 {% set minutes_start_flexed = ['minutu', 'minuty', 'minut'] %}
22 {% set seconds_start_flexed = ['sekundu', 'sekundy', 'sekund'] %}
23 {% set timers_paused_flexed = ['časovač pozastaven.', 'časovače pozastaveny.', 'časovačů pozastaveno.'] %}
24 {% set timers_running_flexed = ['', 'časovače spuštěny.', 'časovačů spuštěno.'] %}
25 {% set num_timers = slots.timers | length %}
26 {% set active_timers = slots.timers | selectattr('is_active') | list %}
27 {% set num_active_timers = active_timers | length %}
28 {% set paused_timers = slots.timers | rejectattr('is_active') | list %}
29 {% set num_paused_timers = paused_timers | length %}
30 {% set next_timer = None %}
31 {% if num_timers == 0: %}
32 Žádné časovače.
33 {% elif num_active_timers == 0: %}
34 {# No active timers #}
35 {% if num_paused_timers == 1: %}
36 {% set next_timer = paused_timers[0] %}
37 Časovač je pozastaven.
38 {% else: %}
39 {{ pluralize_flexed(num_paused_timers, timers_paused_flexed) }}
40 {% endif %}
41 {% else: %}
42 {# At least one active timer #}
43 {% if num_active_timers == 1: %}
44 {% set next_timer = active_timers[0] %}
45 {% else: %}
46 {# Get active timer that will finish soonest #}
47 {% set sorted_timers = active_timers | sort(attribute='total_seconds_left') %}
48 {% set next_timer = sorted_timers[0] %}
49 {{ pluralize_flexed(num_active_timers, timers_running_flexed) }}
50 {% endif %}
51 {{ pluralize_flexed(num_paused_timers, timers_paused_flexed) }}
52 {% endif %}
53 {% if next_timer: %}
54 {# At least one active timer #}
55 Zbývající čas
56 {{ ' '.join([pluralize_flexed(next_timer.rounded_hours_left, hours_flexed), pluralize_flexed(next_timer.rounded_minutes_left, minutes_flexed), pluralize_flexed(next_timer.rounded_seconds_left, seconds_flexed)]) }}
57 {% if num_timers > 1: %}
58 {# Give some extra information to disambiguate #}
59 na časovači spuštěném na
60 {{ ' '.join([pluralize_flexed(next_timer.start_hours, hours_start_flexed), pluralize_flexed(next_timer.start_minutes, minutes_start_flexed), pluralize_flexed(next_timer.start_seconds, seconds_start_flexed)]) }}
61 {% if next_timer.name: %}
62 pojmenovaném {{ next_timer.name }}
63 {% elif next_timer.area: %}
64 v {{ next_timer.area }}
65 {% endif %}
66 {% endif %}
67 {% endif %}