UI-Lovelace-Minimalist / UI

UI-Lovelace-Minimalist is a "theme" for HomeAssistant
https://ui-lovelace-minimalist.github.io/UI/
Other
1.61k stars 430 forks source link

HACS: figure out languages #197

Closed CM000n closed 2 years ago

CM000n commented 2 years ago

fI think we need to align on a moment when we want to move towards hacs support. First we need some documentation around it, a logo, and figure out languages.

We can do some advanced stiff with Jinja if we want to do so.

CM000n commented 2 years ago

Hi @stokkie90, I think this is the way we have to go? https://developers.home-assistant.io/docs/internationalization/custom_integration

stokkie90 commented 2 years ago

So far I know this only works for the python part of the integration. Like the integration configuration page. Maybe we could incorporate it in. But we might need to move towards jinja2 templating. Not sure if that is something we want. I think dwains dashboard work like that.

CM000n commented 2 years ago

You are right.

It seems like he is just declaring an empty dict at first. https://github.com/dwainscheeren/dwains-lovelace-dashboard/blob/8545b42ebbc930789d917f4bf73559afd5c993f5/custom_components/dwains_dashboard/process_yaml.py#L27

then he loads the yaml with the actual translations an ataching that to the _dd_trans variable inside the load_yaml function:

https://github.com/dwainscheeren/dwains-lovelace-dashboard/blob/8545b42ebbc930789d917f4bf73559afd5c993f5/custom_components/dwains_dashboard/process_yaml.py#L210-L215

https://github.com/dwainscheeren/dwains-lovelace-dashboard/blob/8545b42ebbc930789d917f4bf73559afd5c993f5/custom_components/dwains_dashboard/process_yaml.py#L58

After that he can simply use the jinja template in a form like title: {{ _dd_trans.home.title }} in his restlicheCard templates

stokkie90 commented 2 years ago

The way Dwains is working is already somewhat implemented.

https://github.com/stokkie90/UI/blob/main/custom_components/lovelace_minimalist_ui/process_yaml.py#L50 https://github.com/stokkie90/UI/blob/main/custom_components/lovelace_minimalist_ui/process_yaml.py#L176

basbruss commented 2 years ago

closed with #756