Skip to content

Commit e4b5ced

Browse files
authored
OpenAPI: fix i10n for EDR descriptions (#2137) (#2139)
1 parent fa3d129 commit e4b5ced

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

pygeoapi/api/environmental_data_retrieval.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
448448
edr_extension = filter_providers_by_type(
449449
collections[k]['providers'], 'edr')
450450

451+
description = l10n.translate(v['description'], locale)
452+
451453
if edr_extension:
452454
collection_name_path = f'/collections/{k}'
453455

@@ -492,8 +494,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
492494
}
493495
paths[eqe['path']] = {
494496
'get': {
495-
'summary': f"query {v['description']} by {eqe['qt']}",
496-
'description': v['description'],
497+
'summary': f"query {description} by {eqe['qt']}",
498+
'description': description,
497499
'tags': [k],
498500
'operationId': eqe['op_id'],
499501
'parameters': [
@@ -525,8 +527,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
525527
if 'instances' in ep.get_query_types():
526528
paths[f'{collection_name_path}/instances'] = {
527529
'get': {
528-
'summary': f"Get pre-defined instances of {v['description']}", # noqa
529-
'description': v['description'],
530+
'summary': f"Get pre-defined instances of {description}", # noqa
531+
'description': description,
530532
'tags': [k],
531533
'operationId': f'getInstances{k.capitalize()}',
532534
'parameters': [
@@ -541,8 +543,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
541543
}
542544
paths[f'{collection_name_path}/instances/{{instanceId}}'] = {
543545
'get': {
544-
'summary': f"Get {v['description']} instance",
545-
'description': v['description'],
546+
'summary': f"Get {description} instance",
547+
'description': description,
546548
'tags': [k],
547549
'operationId': f'getInstance{k.capitalize()}',
548550
'parameters': [
@@ -558,8 +560,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
558560
if 'locations' in ep.get_query_types():
559561
paths[f'{collection_name_path}/locations'] = {
560562
'get': {
561-
'summary': f"Get pre-defined locations of {v['description']}", # noqa
562-
'description': v['description'],
563+
'summary': f"Get pre-defined locations of {description}", # noqa
564+
'description': description,
563565
'tags': [k],
564566
'operationId': f'getLocations{k.capitalize()}',
565567
'parameters': [
@@ -576,8 +578,8 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
576578
}
577579
paths[f'{collection_name_path}/locations/{{locId}}'] = {
578580
'get': {
579-
'summary': f"query {v['description']} by location",
580-
'description': v['description'],
581+
'summary': f"query {description} by location",
582+
'description': description,
581583
'tags': [k],
582584
'operationId': f'getLocation{k.capitalize()}',
583585
'parameters': [

0 commit comments

Comments
 (0)