Add pre-defined entity name translations (#89792)

This commit is contained in:
Franck Nijhof 2023-03-16 21:10:20 +01:00 committed by GitHub
parent e6f280cf7a
commit f9919bb7cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 402 additions and 4 deletions

View file

@ -28,6 +28,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::alarm_control_panel::title%]",
"state": {
"armed": "Armed",
"disarmed": "Disarmed",

View file

@ -2,6 +2,7 @@
"title": "Alert",
"entity_component": {
"_": {
"name": "[%key:component::alert::title%]",
"state": {
"idle": "[%key:common::state::idle%]",
"off": "Acknowledged",

View file

@ -2,6 +2,7 @@
"title": "Automation",
"entity_component": {
"_": {
"name": "[%key:component::automation::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -108,162 +108,189 @@
},
"entity_component": {
"_": {
"name": "[%key:component::binary_sensor::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"
}
},
"battery": {
"name": "Battery",
"state": {
"off": "Normal",
"on": "Low"
}
},
"battery_charging": {
"name": "Charging",
"state": {
"off": "Not charging",
"on": "Charging"
}
},
"carbon_monoxide": {
"name": "Carbon monoxide",
"state": {
"off": "[%key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"cold": {
"name": "Cold",
"state": {
"off": "[%key:component::binary_sensor::entity_component::battery::state::off%]",
"on": "Cold"
}
},
"connectivity": {
"name": "Connectivity",
"state": {
"off": "[%key:common::state::disconnected%]",
"on": "[%key:common::state::connected%]"
}
},
"door": {
"name": "Door",
"state": {
"off": "[%key:common::state::closed%]",
"on": "[%key:common::state::open%]"
}
},
"garage_door": {
"name": "Garage door",
"state": {
"off": "[%key:common::state::closed%]",
"on": "[%key:common::state::open%]"
}
},
"gas": {
"name": "Gas",
"state": {
"off": "Clear",
"on": "Detected"
}
},
"heat": {
"name": "Heat",
"state": {
"off": "[%key:component::binary_sensor::entity_component::battery::state::off%]",
"on": "Hot"
}
},
"light": {
"name": "Light",
"state": {
"off": "No light",
"on": "Light detected"
}
},
"lock": {
"name": "Lock",
"state": {
"off": "[%key:common::state::locked%]",
"on": "[%key:common::state::unlocked%]"
}
},
"moisture": {
"name": "Moisture",
"state": {
"off": "Dry",
"on": "Wet"
}
},
"motion": {
"name": "Motion",
"state": {
"off": "[key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"moving": {
"name": "Moving",
"state": {
"off": "Not moving",
"on": "Moving"
}
},
"occupancy": {
"name": "Occupancy",
"state": {
"off": "[key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"opening": {
"name": "Opening",
"state": {
"off": "[%key:common::state::closed%]",
"on": "[%key:common::state::open%]"
}
},
"plug": {
"name": "Plug",
"state": {
"off": "Unplugged",
"on": "Plugged in"
}
},
"presence": {
"name": "Presence",
"state": {
"off": "[%key:component::device_tracker::entity_component::_::state::not_home%]",
"on": "[%key:component::device_tracker::entity_component::_::state::home%]"
}
},
"problem": {
"name": "Problem",
"state": {
"off": "OK",
"on": "Problem"
}
},
"running": {
"name": "Running",
"state": {
"off": "Not running",
"on": "Running"
}
},
"safety": {
"name": "Safety",
"state": {
"off": "Safe",
"on": "Unsafe"
}
},
"smoke": {
"name": "Smoke",
"state": {
"off": "[key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"sound": {
"name": "Sound",
"state": {
"off": "[key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"update": {
"name": "Update",
"state": {
"off": "Up-to-date",
"on": "Update available"
}
},
"vibration": {
"name": "Vibration",
"state": {
"off": "[key:component::binary_sensor::entity_component::gas::state::off%]",
"on": "[key:component::binary_sensor::entity_component::gas::state::on%]"
}
},
"window": {
"name": "Window",
"state": {
"off": "[%key:common::state::closed%]",
"on": "[%key:common::state::open%]"

View file

@ -7,5 +7,16 @@
"action_type": {
"press": "Press {entity_name} button"
}
},
"entity_component": {
"_": {
"name": "[%key:component::button::title%]"
},
"restart": {
"name": "Restart"
},
"update": {
"name": "Update"
}
}
}

View file

@ -2,6 +2,7 @@
"title": "Calendar",
"entity_component": {
"_": {
"name": "[%key:component::calendar::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -2,6 +2,7 @@
"title": "Camera",
"entity_component": {
"_": {
"name": "[%key:component::camera::title%]",
"state": {
"recording": "Recording",
"streaming": "Streaming",

View file

@ -17,6 +17,7 @@
},
"entity_component": {
"_": {
"name": "Thermostat",
"state": {
"off": "[%key:common::state::off%]",
"heat": "Heat",

View file

@ -2,6 +2,7 @@
"title": "Configurator",
"entity_component": {
"_": {
"name": "[%key:component::configurator::title%]",
"state": {
"configure": "Configure",
"configured": "Configured"

View file

@ -29,6 +29,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::cover::title%]",
"state": {
"open": "[%key:common::state::open%]",
"opening": "Opening",
@ -44,6 +45,36 @@
"name": "Tilt position"
}
}
},
"awning": {
"name": "Awning"
},
"blind": {
"name": "Blind"
},
"curtain": {
"name": "Curtain"
},
"damper": {
"name": "Damper"
},
"door": {
"name": "Door"
},
"garage": {
"name": "Garage"
},
"gate": {
"name": "Gate"
},
"shade": {
"name": "Shade"
},
"shutter": {
"name": "Shutter"
},
"window": {
"name": "Window"
}
}
}

View file

@ -12,6 +12,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::device_tracker::title%]",
"state": {
"home": "[%key:common::state::home%]",
"not_home": "[%key:common::state::not_home%]"

View file

@ -18,6 +18,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::fan::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -157,6 +157,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::group::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]",

View file

@ -22,10 +22,17 @@
},
"entity_component": {
"_": {
"name": "[%key:component::humidifier::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"
}
},
"dehumidifier": {
"name": "Dehumidifier"
},
"humidifier": {
"name": "[%key:component::humidifier::entity_component::_::name%]"
}
}
}

View file

@ -2,6 +2,7 @@
"title": "Input boolean",
"entity_component": {
"_": {
"name": "[%key:component::input_boolean::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -21,6 +21,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::light::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -17,6 +17,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::lock::title%]",
"state": {
"jammed": "Jammed",
"locked": "[%key:common::state::locked%]",

View file

@ -21,6 +21,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::media_player::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]",
@ -30,6 +31,15 @@
"standby": "[%key:common::state::standby%]",
"buffering": "Buffering"
}
},
"tv": {
"name": "TV"
},
"speaker": {
"name": "Speaker"
},
"receiver": {
"name": "Receiver"
}
}
}

View file

@ -4,5 +4,136 @@
"action_type": {
"set_value": "Set value for {entity_name}"
}
},
"entity_component": {
"_": {
"name": "[%key:component::number::title%]"
},
"apparent_power": {
"name": "[%key:component::sensor::entity_component::apparent_power::name%]"
},
"aqi": {
"name": "[%key:component::sensor::entity_component::aqi::name%]"
},
"atmospheric_pressure": {
"name": "[%key:component::sensor::entity_component::atmospheric_pressure::name%]"
},
"battery": {
"name": "[%key:component::sensor::entity_component::battery::name%]"
},
"carbon_dioxide": {
"name": "[%key:component::sensor::entity_component::carbon_dioxide::name%]"
},
"carbon_monoxide": {
"name": "[%key:component::sensor::entity_component::carbon_monoxide::name%]"
},
"current": {
"name": "[%key:component::sensor::entity_component::current::name%]"
},
"data_rate": {
"name": "[%key:component::sensor::entity_component::data_rate::name%]"
},
"distance": {
"name": "[%key:component::sensor::entity_component::distance::name%]"
},
"energy": {
"name": "[%key:component::sensor::entity_component::energy::name%]"
},
"energy_storage": {
"name": "[%key:component::sensor::entity_component::energy_storage::name%]"
},
"frequency": {
"name": "[%key:component::sensor::entity_component::frequency::name%]"
},
"gas": {
"name": "[%key:component::sensor::entity_component::gas::name%]"
},
"humidity": {
"name": "[%key:component::sensor::entity_component::humidity::name%]"
},
"illuminance": {
"name": "[%key:component::sensor::entity_component::illuminance::name%]"
},
"irradiance": {
"name": "[%key:component::sensor::entity_component::irradiance::name%]"
},
"moisture": {
"name": "[%key:component::sensor::entity_component::moisture::name%]"
},
"nitrogen_dioxide": {
"name": "[%key:component::sensor::entity_component::nitrogen_dioxide::name%]"
},
"nitrogen_monoxide": {
"name": "[%key:component::sensor::entity_component::nitrogen_monoxide::name%]"
},
"nitrous_oxide": {
"name": "[%key:component::sensor::entity_component::nitrous_oxide::name%]"
},
"ozone": {
"name": "[%key:component::sensor::entity_component::ozone::name%]"
},
"pm1": {
"name": "[%key:component::sensor::entity_component::pm1::name%]"
},
"pm10": {
"name": "[%key:component::sensor::entity_component::pm10::name%]"
},
"pm25": {
"name": "[%key:component::sensor::entity_component::pm25::name%]"
},
"power_factor": {
"name": "[%key:component::sensor::entity_component::power_factor::name%]"
},
"power": {
"name": "[%key:component::sensor::entity_component::power::name%]"
},
"precipitation": {
"name": "[%key:component::sensor::entity_component::precipitation::name%]"
},
"precipitation_intensity": {
"name": "[%key:component::sensor::entity_component::precipitation_intensity::name%]"
},
"pressure": {
"name": "[%key:component::sensor::entity_component::pressure::name%]"
},
"reactive_power": {
"name": "[%key:component::sensor::entity_component::reactive_power::name%]"
},
"signal_strength": {
"name": "[%key:component::sensor::entity_component::signal_strength::name%]"
},
"sound_pressure": {
"name": "[%key:component::sensor::entity_component::sound_pressure::name%]"
},
"speed": {
"name": "[%key:component::sensor::entity_component::speed::name%]"
},
"sulphur_dioxide": {
"name": "[%key:component::sensor::entity_component::sulphur_dioxide::name%]"
},
"temperature": {
"name": "[%key:component::sensor::entity_component::temperature::name%]"
},
"volatile_organic_compounds": {
"name": "[%key:component::sensor::entity_component::volatile_organic_compounds::name%]"
},
"voltage": {
"name": "[%key:component::sensor::entity_component::voltage::name%]"
},
"volume": {
"name": "[%key:component::sensor::entity_component::volume::name%]"
},
"volume_storage": {
"name": "[%key:component::sensor::entity_component::volume_storage::name%]"
},
"water": {
"name": "[%key:component::sensor::entity_component::water::name%]"
},
"weight": {
"name": "[%key:component::sensor::entity_component::weight::name%]"
},
"wind_speed": {
"name": "[%key:component::sensor::entity_component::wind_speed::name%]"
}
}
}

View file

@ -2,6 +2,7 @@
"title": "Person",
"entity_component": {
"_": {
"name": "[%key:component::person::title%]",
"state": {
"home": "[%key:common::state::home%]",
"not_home": "[%key:common::state::not_home%]"

View file

@ -2,6 +2,7 @@
"title": "Plant Monitor",
"entity_component": {
"_": {
"name": "[%key:component::plant::title%]",
"state": {
"ok": "[%key:component::binary_sensor::entity_component::problem::state::off%]",
"problem": "[%key:component::binary_sensor::entity_component::problem::state::on%]"

View file

@ -18,6 +18,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::remote::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -2,6 +2,7 @@
"title": "Schedule",
"entity_component": {
"_": {
"name": "[%key:component::schedule::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -2,6 +2,7 @@
"title": "Script",
"entity_component": {
"_": {
"name": "[%key:component::script::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"

View file

@ -96,10 +96,149 @@
},
"entity_component": {
"_": {
"name": "[%key:component::sensor::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"
}
},
"date": {
"name": "Date"
},
"duration": {
"name": "Duration"
},
"apparent_power": {
"name": "Apparent power"
},
"aqi": {
"name": "Air quality index"
},
"atmospheric_pressure": {
"name": "Atmospheric pressure"
},
"battery": {
"name": "Battery"
},
"carbon_monoxide": {
"name": "Carbon monoxide"
},
"carbon_dioxide": {
"name": "Carbon dioxide"
},
"current": {
"name": "Current"
},
"data_rate": {
"name": "Data rate"
},
"data_size": {
"name": "Data size"
},
"distance": {
"name": "Distance"
},
"energy": {
"name": "Energy"
},
"energy_storage": {
"name": "Stored energy"
},
"frequency": {
"name": "Frequency"
},
"gas": {
"name": "Gas"
},
"humidity": {
"name": "Humidity"
},
"illuminance": {
"name": "Illuminance"
},
"irradiance": {
"name": "Irradiance"
},
"moisture": {
"name": "Moisture"
},
"monetary": {
"name": "Balance"
},
"nitrogen_dioxide": {
"name": "Nitrogen dioxide"
},
"nitrogen_monoxide": {
"name": "Nitrogen monoxide"
},
"nitrous_oxide": {
"name": "Nitrous oxide"
},
"ozone": {
"name": "Ozone"
},
"pm1": {
"name": "Particulate matter 0.1 μm"
},
"pm10": {
"name": "Particulate matter 10 μm"
},
"pm25": {
"name": "Particulate matter 2.5 μm"
},
"power_factor": {
"name": "Power factor"
},
"power": {
"name": "Power"
},
"precipitation": {
"name": "Precipitation"
},
"precipitation_intensity": {
"name": "Precipitation intensity"
},
"pressure": {
"name": "Pressure"
},
"reactive_power": {
"name": "Reactive power"
},
"signal_strength": {
"name": "Signal strength"
},
"sound_pressure": {
"name": "Sound pressure"
},
"speed": {
"name": "Speed"
},
"sulphur_dioxide": {
"name": "Sulphur dioxide"
},
"temperature": {
"name": "Temperature"
},
"volatile_organic_compounds": {
"name": "VOCs"
},
"voltage": {
"name": "Voltage"
},
"volume": {
"name": "Volume"
},
"volume_storage": {
"name": "Stored volume"
},
"water": {
"name": "Water"
},
"weight": {
"name": "Weight"
},
"wind_speed": {
"name": "Wind speed"
}
}
}

View file

@ -12,6 +12,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::sun::title%]",
"state": {
"above_horizon": "Above horizon",
"below_horizon": "Below horizon"

View file

@ -18,10 +18,17 @@
},
"entity_component": {
"_": {
"name": "[%key:component::switch::title%]",
"state": {
"off": "[%key:common::state::off%]",
"on": "[%key:common::state::on%]"
}
},
"switch": {
"name": "[%key:component::switch::entity_component::_::name%]"
},
"outlet": {
"name": "Outlet"
}
}
}

View file

@ -1,6 +1,7 @@
{
"entity_component": {
"_": {
"name": "Timer",
"state": {
"active": "[%key:common::state::active%]",
"idle": "[%key:common::state::idle%]",

View file

@ -6,5 +6,13 @@
"turned_on": "{entity_name} got an update available",
"turned_off": "{entity_name} became up-to-date"
}
},
"entity_component": {
"_": {
"name": "[%key:component::update::title%]"
},
"firmware": {
"name": "firmware"
}
}
}

View file

@ -16,6 +16,7 @@
},
"entity_component": {
"_": {
"name": "[%key:component::vacuum::title%]",
"state": {
"cleaning": "Cleaning",
"docked": "Docked",

View file

@ -7,6 +7,7 @@
},
"entity_component": {
"_": {
"name": "Water heater",
"state": {
"off": "[%key:common::state::off%]",
"eco": "Eco",

View file

@ -1,6 +1,7 @@
{
"entity_component": {
"_": {
"name": "Weather",
"state": {
"clear-night": "Clear, night",
"cloudy": "Cloudy",

View file

@ -266,6 +266,7 @@ def gen_strings_schema(config: Config, integration: Integration) -> vol.Schema:
},
vol.Optional("entity_component"): cv.schema_with_slug_keys(
{
vol.Optional("name"): str,
vol.Optional("state"): cv.schema_with_slug_keys(
cv.string_with_no_html,
slug_validator=translation_key_validator,

View file

@ -383,22 +383,25 @@ async def test_caching(hass: HomeAssistant) -> None:
for key in load1:
assert key.startswith(
"component.sensor.entity_component._.state."
) or key.startswith("component.light.entity_component._.state.")
(
"component.sensor.entity_component.",
"component.light.entity_component.",
)
)
load_sensor_only = await translation.async_get_translations(
hass, "en", "entity_component", integrations={"sensor"}
)
assert load_sensor_only
for key in load_sensor_only:
assert key.startswith("component.sensor.entity_component._.state.")
assert key.startswith("component.sensor.entity_component.")
load_light_only = await translation.async_get_translations(
hass, "en", "entity_component", integrations={"light"}
)
assert load_light_only
for key in load_light_only:
assert key.startswith("component.light.entity_component._.state.")
assert key.startswith("component.light.entity_component.")
hass.config.components.add("media_player")