Skip to content

Feat/timer translation#121

Open
rummens wants to merge 127 commits intodinki:mainfrom
rummens:feat/timer-translation
Open

Feat/timer translation#121
rummens wants to merge 127 commits intodinki:mainfrom
rummens:feat/timer-translation

Conversation

@rummens
Copy link

@rummens rummens commented Apr 27, 2025

Here is a first working version of the timer transcription. It was a bit more work than expected, so I added a few unittests to make sure I didnt mess things up. I tried to describe the required changes/steps in the timers.md

I would suggest we first discuss this PR, then I can add the Spanish translation. I can try to add french too but only with auto translation. What do you think?

I wasnt really sure what to do with the snooze service. The yaml made it expect a number but the code expected a string. If passed just a number of minutes (e.g. 5) the function decode_time_sentence would always fail to match a regex and therefore return None. This didnt feel right. Also the blueprint is passing a string (which is techniclly against the service definition). So I updated the yaml, hope that was the right way forward? It is a breaking change unforunetly.

This bring the changed service to two (both require a language to be passed now): set_timerand snooze_timer

I also wasn't sure why this condition is present, so I didn't translate it. If you can help figure this out, I would appreciate it.

Updating this code showed me how much work and effort went into this project. So big applause to everyone involved :) Hopefully I can contribute a little to make it even better.

(P.S. also happy to support translating the settings of the integration, I saw there is config file. But lets leave that for another day)

msp1974 and others added 30 commits April 18, 2025 17:31
fix: setting mode via set_state service did not update runtime data
fix: failed to set mimic device if non native browser id
…s bar and menu items

Introduces a dedicated MenuManager class to handle menu state, toggling, timeouts, and dynamic status items. Supports adding/removing items programmatically.
Add menu manager initialization to common functions and store in component data.
Add menu-related configuration options to the UI flow including enable menu, timeout settings, and display options.
Define menu-related configuration constants and set default values for menu functionality.
Add path tracking for menu filtering and ensure menu buttons maintain position when status icons change.
Implement utility functions for status icon arrangement, normalization, and menu item management.
Add menu-related attributes to entity and implement method to get active menu state.
Implement service handlers for toggling menu visibility and managing menu items.
Add service definitions for toggle_menu, add_status_item, and remove_status_item with parameters.
Add menu control attributes to DisplayConfig dataclass to support the new menu management system.
Include translation strings for menu-related UI configuration elements.
Replace boolean toggles with a single dropdown selector
Remove boolean menu config options in favor of consolidated approach
Update manager to handle menu settings based on VAMenuConfig enum
Add menu_config dropdown selector and remove old boolean toggles
dinki and others added 25 commits May 26, 2025 14:45
Move dev to main for new release
Fix for issue dinki#134 and minor improvements
Fix: sometimes blueprint domain is not yet loaded when onboarding blueprints
fix: dashboard not updating from repo
fix: error loading audio only device
…t/timer-translation

# Conflicts:
#	custom_components/view_assist/services.py
@dinki
Copy link
Owner

dinki commented Jun 27, 2025

@rummens Thanks for this. Wow. Looks like lots of changes. Will want to rope in @msp1974 for additional review. One thing of note is that this is targeting main instead of dev branch. Can you update?

@msp1974
Copy link
Contributor

msp1974 commented Sep 20, 2025

@rummens, firstly my sincere apologies that it has taken so long to get back to you on this.

When I saw your translation file, I felt that it was going to be too difficult for people who are not capable developers to do a translation and therefore we would end up with just English and German (or other languages you or I could do).

As such, I have been busy doing some rewrites of the integration and relooked at how we do timers to make internationalisation simpler. I have taken the approach to translate the sentence into english first and then process it to a time/interval. This has significantly simplified the whole process and the code is now completely new.

Below is an example of the now required translation file - which you will see should be capable of being created by most people, just changing the right hand side of the key/value pairs.

Still not quite finalised and I am looking to see if we can get any of this from the existing HASS translations to reduce it further.

Just sharing, so you know that progress is being made and that you will see this in a release in the not too distant future.

{
    "decimal_separator": ",",
    "numbers": {
        "zero": "null",
        "one": "eins",
        "two": "zwei",
        "three": "drei",
        "four": "vier",
        "five": "fünf",
        "six": "sechs",
        "seven": "sieben",
        "eight": "acht",
        "nine": "neun",
        "ten": "zehn",
        "eleven": "elf",
        "twelve": "zwölf",
        "thirteen": "dreizehn",
        "fourteen": "vierzehn",
        "fifteen": "fünfzehn",
        "sixteen": "sechzehn",
        "seventeen": "siebzehn",
        "eighteen": "achtzehn",
        "nineteen": "neunzehn",
        "twenty": "zwanzig",
        "thirty": "dreißig",
        "forty": "vierzig",
        "fifty": "fünfzig"
    },
    "days": {
        "monday": "montag",
        "tuesday": "dienstag",
        "wednesday": "mittwoch",
        "thursday": "donnerstag",
        "friday": "freitag",
        "saturday": "samstag",
        "sunday": "sonntag",
        "today": "heute",
        "tomorrow": "morgen"
    },
    "durations": {
        "day": ["tage", "tag"],
        "hour": ["stunden", "stunde", "stde", "std"],
        "minute": ["minuten", "minute", "min"],
        "second": ["sekunden", "zweite", "sek"]
    },
    "hour_prefixes": {
        "to": ["vor"],
        "past": ["nach"]
    },
    "meridiem": {
        "am": ["morgens"],
        "pm": ["nachmittags", "abends", "nachts", "heute abend"]
    },
    "special_minutes": {
        "oclock": [""],
        "quarter": ["viertel", "1/4"],
        "half": ["halbe", "halb", "1/2"],
        "threequarter": ["drei viertel", "3/4"]
    },
    "remove_words": ["die", "an", "um", "in", "dieser", "uhr", "und"],
    "replace_text": {
        "ein": " "
    }
}

@rummens
Copy link
Author

rummens commented Sep 21, 2025

Hey @msp1974, this looks fantastic and much cleaner indeed. Let me know if you need help pushing translations :-)
And sorry for being inactive for a bit, I have a lot of topics going right now 🤪

@dinki
Copy link
Owner

dinki commented Jan 27, 2026

Hey guys, this one has been around for a bit. I am not tracking fully. Is this still a WIP? @rummens @msp1974

@rummens
Copy link
Author

rummens commented Jan 27, 2026

No I havent worked on this for a while, since I parked the whole Voice Assistant topic for now. But if @msp1974 needs help to validate some things I can jump in 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants