From 627a46b5541e311789232ed3d4884ca354a50a93 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Tue, 21 Oct 2025 22:55:14 -0400 Subject: [PATCH] OpenAPI: fix i10n for EDR descriptions (#2137) --- pygeoapi/api/environmental_data_retrieval.py | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/pygeoapi/api/environmental_data_retrieval.py b/pygeoapi/api/environmental_data_retrieval.py index 7e1b1320d..b1a6538b5 100644 --- a/pygeoapi/api/environmental_data_retrieval.py +++ b/pygeoapi/api/environmental_data_retrieval.py @@ -448,6 +448,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, edr_extension = filter_providers_by_type( collections[k]['providers'], 'edr') + description = l10n.translate(v['description'], locale) + if edr_extension: collection_name_path = f'/collections/{k}' @@ -492,8 +494,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, } paths[eqe['path']] = { 'get': { - 'summary': f"query {v['description']} by {eqe['qt']}", - 'description': v['description'], + 'summary': f"query {description} by {eqe['qt']}", + 'description': description, 'tags': [k], 'operationId': eqe['op_id'], 'parameters': [ @@ -525,8 +527,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, if 'instances' in ep.get_query_types(): paths[f'{collection_name_path}/instances'] = { 'get': { - 'summary': f"Get pre-defined instances of {v['description']}", # noqa - 'description': v['description'], + 'summary': f"Get pre-defined instances of {description}", # noqa + 'description': description, 'tags': [k], 'operationId': f'getInstances{k.capitalize()}', 'parameters': [ @@ -541,8 +543,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, } paths[f'{collection_name_path}/instances/{{instanceId}}'] = { 'get': { - 'summary': f"Get {v['description']} instance", - 'description': v['description'], + 'summary': f"Get {description} instance", + 'description': description, 'tags': [k], 'operationId': f'getInstance{k.capitalize()}', 'parameters': [ @@ -558,8 +560,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, if 'locations' in ep.get_query_types(): paths[f'{collection_name_path}/locations'] = { 'get': { - 'summary': f"Get pre-defined locations of {v['description']}", # noqa - 'description': v['description'], + 'summary': f"Get pre-defined locations of {description}", # noqa + 'description': description, 'tags': [k], 'operationId': f'getLocations{k.capitalize()}', 'parameters': [ @@ -576,8 +578,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, } paths[f'{collection_name_path}/locations/{{locId}}'] = { 'get': { - 'summary': f"query {v['description']} by location", - 'description': v['description'], + 'summary': f"query {description} by location", + 'description': description, 'tags': [k], 'operationId': f'getLocation{k.capitalize()}', 'parameters': [