Skip to content

Commit

Permalink
[HU] Optimization of response, handling of articles, correction of nu…
Browse files Browse the repository at this point in the history
…mber format (home-assistant#1899)

* Updating Hungarian intentions

The current intentions are unusable, as they do not employ conjugations at any level. The entire language, which utilizes conjugations, has been updated.

Due to the nature of the Hungarian language, there's an issue where word roots change with conjugation. (For example, if the room is a kitchen, instead of "kapcsold be az összes ventilátort a konyhaban", it should be "konyhában".)

I circumvented these with suffix words, like using "piros színre" instead of "pirosra", or by changing the word order to avoid these issues. This way, it works, like "kapcsold be a konyha összes ventilátorát is."

But for correct and complete Hungarian expressions, it's advisable to use assistant aliases for room names whose endings change with conjugation, such as "szoba" (room), "konyha" (kitchen). For these, "szobá" and "konyhá" aliases should be added.

* Updating Hungarian intentions rev2

* [HU] Added the sensor_HassGetState and the 'in_here' function

with this, the Hungarian translation became 100%

Added the [in here] feature:
cover_HassTurnOff
cover_HassTurnOn
light_HassLightSet
light_HassTurnOff
light_HassTurnOn
fan_HassTurnOff
fan_HassTurnOn

New:
sensor_HassGetState

* [HU] Added the sensor_HassGetState and the 'in_here' function v2

* [hu] More flexible word order, bug fix, +2 color

More flexible word order, especially for lighting
+2 color translations
a minor bug fix
more readable code.

* [hu] More flexible word order, bug fix, +2 color

More flexible word order, especially for lighting
+2 color translations
a minor bug fix
more readable code.

* [hu] More flexible word order, bug fix, +2 color

More flexible word order, especially for lighting
+2 color translations
a minor bug fix
more readable code.

* [hu] bugfix

bugfix
due to the free word order, different suffixes are also needed.

* [hu] bugfix

* bugfix v2

* [HU] Translation of error messages + handling of articles in the error message.

Thank you to the contributors of ticket home-assistant#1895. This way, I learned that error messages can be processed :) Following the French model, the Hungarian error messages have now become completely Hungarian. + it also handles the articles of words.

+optimization in the Todo/Shopping list, I reduced the number of variations with the specified suffixes.

* [HU] Optimization of response, handling of articles, correction of number format

I have corrected the responses to put the correct article in front of the word.
The number format correction involves changing 12.1 to 12,1 and replacing "-" with the word "minus".

And an attempt to find out what cover states the live system returns in the live environment. If it's English, then from now on it should also display it in Hungarian; if it's not English, then everything remains as it was.
  • Loading branch information
v1k70rk4 authored and schizza committed Mar 16, 2024
1 parent 3a52b1a commit d97fbc3
Show file tree
Hide file tree
Showing 19 changed files with 147 additions and 40 deletions.
11 changes: 10 additions & 1 deletion responses/hu/HassClimateGetTemperature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,13 @@ responses:
HassClimateGetTemperature:
default: >
{% set temperature = state_attr(state.entity_id, 'current_temperature') %}
{{ temperature }} fok
{% if temperature is number %}
{% if temperature < 0 %}
{% set temperature_string = 'mínusz ' ~ (temperature * -1) | string | replace('.', ',') %}
{% else %}
{% set temperature_string = temperature | string | replace('.', ',') %}
{% endif %}
{{ temperature_string }} fok
{% else %}
Nem várt eredmény: {{ temperature }}
{% endif %}
30 changes: 27 additions & 3 deletions responses/hu/HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ responses:
{% elif state.state == "not_home" %}
{{ slots.name | capitalize }} távol van
{% else %}
{{ slots.name | capitalize }} itt van: {{ state.state }}
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set state_string = state.state | string %}
{% set elso_betu = state_string[0].lower() if state_string not in ["home", "not_home"] else 'o' %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "az" %}
{% else %}
{% set nevelo = "a" %}
{% endif %}
{{ slots.name | capitalize }} {{ nevelo }} {{ state_string }} zónában van
{% endif %}
one_yesno_where: |
Expand All @@ -85,7 +93,15 @@ responses:
{% elif state.state == 'away' %}
Nem, távol van
{% else %}
Nem, itt van: {{ state.state }}
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set state_string = state.state | string %}
{% set elso_betu = state_string[0].lower() if state_string not in ["home", "not_home"] else 'o' %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "az" %}
{% else %}
{% set nevelo = "a" %}
{% endif %}
Nem, {{ nevelo }} {{ state_string }} zónában van
{% endif %}
{% endif %}
Expand All @@ -107,7 +123,15 @@ responses:
{% elif state.state == "away" %}
távol van
{% else %}
itt van: {{ state.state }}
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set state_string = state.state | string %}
{% set elso_betu = state_string[0].lower() if state_string not in ["home", "not_home"] else 'o' %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "az" %}
{% else %}
{% set nevelo = "a" %}
{% endif %}
{{ nevelo }} {{ state_string }} zónában van
{% endif %}
{% endif %}
{% endif %}
8 changes: 7 additions & 1 deletion responses/hu/HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ responses:
'windy': 'és szeles',
'windy-variant': 'széllel és felhőkkel'
} %}
{{ state.attributes.get('temperature') }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
{% set temperature = state.attributes.get('temperature') | float %}
{% if temperature < 0 %}
{% set temperature_string = 'mínusz ' ~ (temperature * -1) | string | replace('.', ',') %}
{% else %}
{% set temperature_string = temperature | string | replace('.', ',') %}
{% endif %}
{{ temperature_string }} {{ state.attributes.get('temperature_unit') }} {{ weather_condition.get((state.state | string).lower(), "") }}
10 changes: 9 additions & 1 deletion responses/hu/HassListAddItem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ language: "hu"
responses:
intents:
HassListAddItem:
item_added: "{{ slots.item }} hozzáadva"
item_added: |
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set elso_betu = slots.item[0].lower() %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "Az" %}
{% else %}
{% set nevelo = "A" %}
{% endif %}
{{ nevelo }} {{ slots.item }} hozzáadva a listához
10 changes: 9 additions & 1 deletion responses/hu/HassShoppingListAddItem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ language: "hu"
responses:
intents:
HassShoppingListAddItem:
item_added: "{{ slots.item }} hozzáadva"
item_added: |
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set elso_betu = slots.item[0].lower() %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "Az" %}
{% else %}
{% set nevelo = "A" %}
{% endif %}
{{ nevelo }} {{ slots.item }} hozzáadva a listához
29 changes: 27 additions & 2 deletions responses/hu/HassTurnOff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,35 @@ language: hu
responses:
intents:
HassTurnOff:
default: "{{ slots.name }} kikapcsolva"
default: |
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set elso_betu = slots.name[0].lower() %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "Az" %}
{% else %}
{% set nevelo = "A" %}
{% endif %}
{{ nevelo }} {{ slots.name }} kikapcsolva
lights_area: "A lámpák kikapcsolva"
fans_area: "A ventilátorok kikapcsolva"
fans_all: "Az összes ventilátor kikapcsolva"
cover: "Bezárva"
cover_device_class: "Bezárva"
lock: "Kinyitva"
cover_device_class: |
{% set device_class_translations = {
"awning": "A napellenző",
"blind": "A redőny",
"curtain": "A függöny",
"door": "Az ajtó",
"garage": "A garázskapu",
"gate": "A kapu",
"shade": "Az árnyékoló",
"shutter": "A zsalu",
"window": "Az ablak"
} %}
{% set device_class = slots.device_class %}
{% if device_class in device_class_translations %}
{{ device_class_translations[device_class] }} bezárva
{% else %}
Bezárva
{% endif %}
29 changes: 27 additions & 2 deletions responses/hu/HassTurnOn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,37 @@ language: hu
responses:
intents:
HassTurnOn:
default: "{{ slots.name }} bekapcsolva"
default: |
{% set magyar_maganhangzok = "aáeéiíoóöőuúüű" %}
{% set elso_betu = slots.name[0].lower() %}
{% if elso_betu in magyar_maganhangzok %}
{% set nevelo = "Az" %}
{% else %}
{% set nevelo = "A" %}
{% endif %}
{{ nevelo }} {{ slots.name }} bekapcsolva
lights_area: "A lámpák bekapcsolva"
light_all: "Az összes lámpa bekapcsolva"
fans_area: "A ventilátorok bekapcsolva"
cover: "Kinyitva"
cover_device_class: "Kinyitva"
scene: "Aktiválva"
script: "Elindítva"
lock: "Bezárva"
cover_device_class: |
{% set device_class_translations = {
"awning": "A napellenző",
"blind": "A redőny",
"curtain": "A függöny",
"door": "Az ajtó",
"garage": "A garázskapu",
"gate": "A kapu",
"shade": "Az árnyékoló",
"shutter": "A zsalu",
"window": "Az ablak"
} %}
{% set device_class = slots.device_class %}
{% if device_class in device_class_translations %}
{{ device_class_translations[device_class] }} kinyitva
{% else %}
Kinyitva
{% endif %}
4 changes: 2 additions & 2 deletions sentences/hu/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ responses:
"alarm_control_panel": "riasztót",
"automation": "automatizálást",
"fan": "ventilátort",
"climate": "termosztátot",
"climate": "hőmérsékletszabályozót",
"humidifier": "párásítót",
"input_boolean": "kapcsolót",
"siren": "szirénát",
"water_heater": "melegvíz-tartályt",
"water_heater": "melegvíz tartályt",
"light": "lámpát",
"switch": "kapcsolót",
"script": "szkriptet",
Expand Down
9 changes: 2 additions & 7 deletions sentences/hu/weather_HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@ intents:
HassGetWeather:
data:
- sentences:
- "Milyen [az] időjárás [van] [ma|most]"
- "Milyen idő van [ma]"
- "Milyen az idő"
- "Milyen [az] idő[járás] [van] [ma|most]"
- sentences:
- "Milyen [az] időjárás [van] [ma|most] <name>[<ragok>| <időjáráshelyek>]"
- "Milyen idő van [ma|most] <name>[<ragok>| <időjáráshelyek>]"
- "<name>[<ragok>| <időjáráshelyek>] milyen [az] időjárás [van] [ma|most]"
- "<name>[<ragok>| <időjáráshelyek>] milyen idő van [ma|most]"
- "(Milyen [az] idő[járás] [van] [ma|most];<name>(<ragok>| <időjáráshelyek>))"
requires_context:
domain: weather
11 changes: 9 additions & 2 deletions tests/hu/_fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ entities:
area: "living_room"
state: "heat"
attributes:
current_temperature: 22
current_temperature: 22.1

- name: "Irodai termosztát"
id: "climate.office_thermostat"
area: "office"
state: "heat"
attributes:
current_temperature: 21
current_temperature: 21.2

- name: "Budapest"
id: "weather.budapest"
Expand All @@ -337,6 +337,13 @@ entities:
temperature: "26"
temperature_unit: "°C"

- name: "Teszt város"
id: "weather.teszt"
state: "és tiszta"
attributes:
temperature: "-2.2"
temperature_unit: "°C"

- name: "party mód"
id: "scene.party_mode"

Expand Down
6 changes: 3 additions & 3 deletions tests/hu/climate_HassClimateGetTemperature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tests:
- "hány fok van?"
intent:
name: HassClimateGetTemperature
response: "22 fok"
response: "22,1 fok"

- sentences:
- "mennyi a hőmérséklet a nappaliban?"
Expand All @@ -18,7 +18,7 @@ tests:
name: HassClimateGetTemperature
slots:
area: nappali
response: "22 fok"
response: "22,1 fok"

- sentences:
- "Mi az irodai termosztát jelenlegi hőmérséklete?"
Expand All @@ -30,4 +30,4 @@ tests:
name: HassClimateGetTemperature
slots:
name: Irodai termosztát
response: "21 fok"
response: "21,2 fok"
2 changes: 1 addition & 1 deletion tests/hu/cover_HassTurnOff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tests:
slots:
domain: cover
device_class: garage
response: "Bezárva"
response: "A garázskapu bezárva"

- sentences:
- "Zárd be az ablakot a konyhaban"
Expand Down
2 changes: 1 addition & 1 deletion tests/hu/cover_HassTurnOn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tests:
slots:
domain: cover
device_class: garage
response: "Kinyitva"
response: "A garázskapu kinyitva"

- sentences:
- "nyisd ki az ablakot a konyhaban"
Expand Down
2 changes: 1 addition & 1 deletion tests/hu/homeassistant_HassTurnOff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tests:
name: HassTurnOff
slots:
name: mennyezeti ventilátor
response: "mennyezeti ventilátor kikapcsolva"
response: "A mennyezeti ventilátor kikapcsolva"
2 changes: 1 addition & 1 deletion tests/hu/homeassistant_HassTurnOn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ tests:
name: HassTurnOn
slots:
name: mennyezeti ventilátor
response: "mennyezeti ventilátor bekapcsolva"
response: "A mennyezeti ventilátor bekapcsolva"
8 changes: 4 additions & 4 deletions tests/hu/person_HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tests:
slots:
domain: person
name: "Jóska"
response: "Jóska itt van: otthon"
response: "Jóska az otthon zónában van"

- sentences:
- "Hol van Marika"
Expand All @@ -17,7 +17,7 @@ tests:
slots:
domain: person
name: "Marika"
response: "Marika itt van: munkahely"
response: "Marika a munkahely zónában van"

- sentences:
- "Marika otthon van"
Expand All @@ -29,7 +29,7 @@ tests:
domain: person
name: "Marika"
state: "otthon "
response: "Nem, itt van: munkahely"
response: "Nem, a munkahely zónában van"

- sentences:
- "Valaki van az otthon zónában"
Expand All @@ -48,7 +48,7 @@ tests:
slots:
domain: person
state: "otthon "
response: "Nem, Marika itt van: otthon"
response: "Nem, Marika az otthon zónában van"

- sentences:
- "Ki van otthon zónában"
Expand Down
6 changes: 3 additions & 3 deletions tests/hu/shopping_list_HassShoppingListAddItem.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
language: hu
tests:
- sentences:
- Tedd az Alma elemet a bevásárló listához
- Rakd az Alma tételt a bevásárló listához
- Tedd az Alma elemet a bevásárlólistához
- Rakd az Alma tételt a bevásárlólistához
intent:
name: HassShoppingListAddItem
slots:
item: "alma "
response: alma hozzáadva
response: Az alma hozzáadva a listához
2 changes: 1 addition & 1 deletion tests/hu/todo_HassListAddItem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ tests:
slots:
item: "alma "
name: "fontos dolgok"
response: alma hozzáadva
response: Az alma hozzáadva a listához
6 changes: 3 additions & 3 deletions tests/hu/weather_HassGetWeather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tests:
- "Milyen az idő?"
intent:
name: HassGetWeather
response: 23 °C
response: 23,0 °C

- sentences:
- "Milyen idő van Budapesten"
Expand All @@ -23,12 +23,12 @@ tests:
name: HassGetWeather
slots:
name: Budapest
response: 23 °C
response: 23,0 °C

- sentences:
- "Milyen az időjárás Szolnokon?"
intent:
name: HassGetWeather
slots:
name: Szolnok
response: 26 °C
response: 26,0 °C

0 comments on commit d97fbc3

Please sign in to comment.