Hey all. My project View Assist extends Assist capabilities through custom sentence blueprints. I would like to make these multilingual but my efforts have not been met with success. I am trying to create a dictionary for each language and having those translations used in the blueprint description, name and other display settings. Unfortunately what I have is showing the JINJA text rather than the expanded variable values. This would make things easy to translate, self contained and distributable. This would go a long way in unifying the Home Assistant community so that a common code base can be used but extending to multiple languages.
Here’s the attempt:
blueprint:
name: View Assist - Multilingual
description: Ask "How's the Weather?" and ViewAssist will respond with the weather and show the weather view (View Assist howstheweather v 1.0.0)
domain: automation
input:
command_prompt:
name: >-
{{ translations[language]['command_prompt']['name'] }}
description: >-
{{ translations[language]['command_prompt']['description'] }}
default: >-
{{ translations[language]['command_prompt']['default'] }}
weather_entity:
name: >-
{{ translations[language]['weather_entity']['name'] }}
description: >-
{{ translations[language]['weather_entity']['description'] }}
selector:
entity:
filter:
- domain: weather
group_entity:
name: >-
{{ translations[language]['group_entity']['name'] }}
description: >-
{{ translations[language]['group_entity']['description'] }}
selector:
entity:
filter:
- domain: group
default: "group.viewassist_satellites"
dashboard:
name: >-
{{ translations[language]['dashboard']['name'] }}
description: >-
{{ translations[language]['dashboard']['description'] }}
default: "/dashboard-viewassist/weather"
alias: View Assist - How's the Weather
description: "Provides information on the current weather and forecast"
trigger:
- platform: conversation
command: !input command_prompt
variables:
language: "es"
group_entity: !input group_entity
weather_entity: !input weather_entity
dashboard: !input dashboard
translations:
en:
command_prompt:
name: "Command Text"
description: "The phrase you want to use to trigger the automation"
default: "(How's | How is | What's | What is) [the] weather"
weather_entity:
name: "Weather Entity"
description: "The entity that provides weather information (example weather.home)"
group_entity:
name: "Group Entity"
description: "The group that holds the list of View Assist satellites (example group.viewassist_satellites)"
dashboard:
name: "Dashboard Weather view"
description: "The View Assist dashboard view to use for weather (example /dashboard-viewassist/weather)"
responses:
temperature: "It's {temperature} degrees and {condition}"
es:
command_prompt:
name: "Texto de comando"
description: "La frase que desea usar para activar la automatización"
default: "(¿Cómo está | Cómo está | ¿Cuál es | Cuál es) [el] clima"
weather_entity:
name: "Entidad meteorológica"
description: "La entidad que proporciona información meteorológica (ejemplo weather.home)"
group_entity:
name: "Entidad de grupo"
description: "El grupo que contiene la lista de satélites de View Assist (ejemplo group.viewassist_satellites)"
dashboard:
name: "Vista del clima en el tablero"
description: "La vista del tablero de View Assist para usar para el clima (ejemplo /dashboard-viewassist/weather)"
responses:
temperature: "Hace {temperature} grados y está {condition}"
condition: []
action:
- set_conversation_response: >-
{{ translations[language]['responses']['temperature'].replace("{temperature}", state_attr(weather_entity, 'temperature')).replace("{condition}", states[weather_entity].state) }}
enabled: true
mode: single
And this is what it looks like:
I am unsure how the blueprints are rendered and if this would be possible currently but hopefully the value of doing this will not be lost on the developers. Thanks!
EDIT I am certainly open to any other methods that would allow this to happen but would kindly request that whatever the alternative solution it should allow for the translation dictionary to be included within the blueprint file itself to make distribution and installation as easy as it is now.