mirror of
https://github.com/home-assistant/core.git
synced 2026-04-27 12:14:35 +01:00
Add support for placeholders in entity name translations (#104453)
* add placeholder support to entity name translation * add negativ tests * make property also available via description * fix doc string in translation_placeholders() * fix detection of placeholder * validate placeholders for localized strings * add test * Cache translation_placeholders property * Make translation_placeholders uncondotionally return dict * Fall back to unsubstituted name in case of mismatch * Only replace failing translations with English * Update snapshots * Blow up on non stable releases * Fix test * Update entity.py --------- Co-authored-by: Erik <erik@montnemery.com> Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"entity": {
|
||||
"switch": {
|
||||
"other1": { "name": "Anderes 1" },
|
||||
"other2": { "name": "Anderes 2 {placeholder}" },
|
||||
"other3": { "name": "" },
|
||||
"outlet": { "name": "Steckdose {something}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"entity": {
|
||||
"switch": {
|
||||
"other1": { "name": "Other 1" },
|
||||
"other2": { "name": "Other 2" },
|
||||
"other3": { "name": "Other 3" },
|
||||
"other4": { "name": "Other 4" },
|
||||
"outlet": { "name": "Outlet {placeholder}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"entity": {
|
||||
"switch": {
|
||||
"other1": { "name": "Otra 1" },
|
||||
"other2": { "name": "Otra 2" },
|
||||
"other3": { "name": "Otra 3" },
|
||||
"other4": { "name": "Otra 4" },
|
||||
"outlet": { "name": "Enchufe {placeholder}" }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user