How a translate values in a vol.In schema?

Hello,

I’m writing an integration. I’m using the config_flow to configure it.
I’m facing a case which I can’t figure out how to do:
I have the following schema:

vol.Schema(
            {
                vol.Required(CONF_NAME): cv.string,
                vol.Required(
                    CONF_THERMOSTAT_TYPE, default=CONF_THERMOSTAT_SWITCH
                ): vol.In(CONF_THERMOSTAT_TYPES)
)

Where CONF_THERMOSTAT_TYPES is defined as [“thermostat_over_switch”, “thermostat_over_climate”]

I have define my translations for thermostat_over_switch and thermostat_over_climate in strings.json and en.json but there are not applied. Translations are the following:

"step": {
      "user": {
        "title": "Add new Versatile Thermostat",
        "description": "Main mandatory attributes",
        "data": {
          "name": "Name",
          "thermostat_type": "Thermostat type",
          "thermostat_over_switch": "Thermostat over a switch",
          "thermostat_over_climate": "Thermostat over another thermostat",

Any clues ?

I found this article in translation documentation: Backend Localization | Home Assistant Developer Docs

And I think it is my problem but it don’t work either. My configuration is the following:

{
  "title": "Versatile Thermostat configuration",
  "config": {
    "flow_title": "Versatile Thermostat configuration",
    "step": {
      "user": {
        "title": "Add new Versatile Thermostat",
        "description": "Main mandatory attributes",
        "data": {
          "name": "Name",
          "thermostat_type": "Thermostat type",
...        }
      }
    },
    "selectors": {
      "thermostat_type": {
        "options": {
          "thermostat_over_switch": "Thermostat over a switch",
          "thermostat_over_climate": "Thermostat over another thermostat"
        }
      }
    },

This seems to be conform with the documentation

No idea ?
Nobody uses this ?

According to the documentation, the “selectors”: mapping should be on the same level as the “config”: mapping, not within it.

However, even after that correction I still have issues displaying the options translations…

1 Like