5858 selector ,
5959 target as target_helpers ,
6060 template ,
61- translation ,
6261)
6362from .deprecation import deprecated_class , deprecated_function , deprecated_hass_argument
6463from .selector import TargetSelector
@@ -586,11 +585,6 @@ async def async_get_all_descriptions(
586585 _load_services_files , integrations
587586 )
588587
589- # Load translations for all service domains
590- translations = await translation .async_get_translations (
591- hass , "en" , "services" , services
592- )
593-
594588 # Build response
595589 descriptions : dict [str , dict [str , Any ]] = {}
596590 for domain , services_map in services .items ():
@@ -617,40 +611,11 @@ async def async_get_all_descriptions(
617611
618612 # Don't warn for missing services, because it triggers false
619613 # positives for things like scripts, that register as a service
620- #
621- # When name & description are in the translations use those;
622- # otherwise fallback to backwards compatible behavior from
623- # the time when we didn't have translations for descriptions yet.
624- # This mimics the behavior of the frontend.
625- description = {
626- "name" : translations .get (
627- f"component.{ domain } .services.{ service_name } .name" ,
628- yaml_description .get ("name" , "" ),
629- ),
630- "description" : translations .get (
631- f"component.{ domain } .services.{ service_name } .description" ,
632- yaml_description .get ("description" , "" ),
633- ),
634- "fields" : dict (yaml_description .get ("fields" , {})),
635- }
636-
637- # Translate fields names & descriptions as well
638- for field_name , field_schema in description ["fields" ].items ():
639- if name := translations .get (
640- f"component.{ domain } .services.{ service_name } .fields.{ field_name } .name"
641- ):
642- field_schema ["name" ] = name
643- if desc := translations .get (
644- f"component.{ domain } .services.{ service_name } .fields.{ field_name } .description"
645- ):
646- field_schema ["description" ] = desc
647- if example := translations .get (
648- f"component.{ domain } .services.{ service_name } .fields.{ field_name } .example"
649- ):
650- field_schema ["example" ] = example
651-
652- if "target" in yaml_description :
653- description ["target" ] = yaml_description ["target" ]
614+ description = {"fields" : yaml_description .get ("fields" , {})}
615+
616+ for item in ("description" , "name" , "target" ):
617+ if item in yaml_description :
618+ description [item ] = yaml_description [item ]
654619
655620 response = service .supports_response
656621 if response is not SupportsResponse .NONE :
0 commit comments