From a26662e0e4acf1be37892454cc2b7dd4953caad5 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Fri, 12 Apr 2024 09:50:46 -0400 Subject: [PATCH] add l10n to link titles (#1624) (#1625) --- locale/bs/LC_MESSAGES/messages.po | 98 +++++++++++++++++++++++++++++++ locale/de/LC_MESSAGES/messages.po | 98 +++++++++++++++++++++++++++++++ locale/en/LC_MESSAGES/messages.po | 98 +++++++++++++++++++++++++++++++ locale/fr/LC_MESSAGES/messages.po | 98 +++++++++++++++++++++++++++++++ locale/sr/LC_MESSAGES/messages.po | 98 +++++++++++++++++++++++++++++++ pygeoapi/api/__init__.py | 76 +++++++++++++----------- pygeoapi/api/itemtypes.py | 20 +++---- pygeoapi/api/processes.py | 28 ++++----- pygeoapi/api/tiles.py | 12 ++-- 9 files changed, 563 insertions(+), 63 deletions(-) diff --git a/locale/bs/LC_MESSAGES/messages.po b/locale/bs/LC_MESSAGES/messages.po index 9188cbb..b5e87f9 100644 --- a/locale/bs/LC_MESSAGES/messages.po +++ b/locale/bs/LC_MESSAGES/messages.po @@ -534,3 +534,101 @@ msgstr "Matrica tile-ova dostupna u ovoj usluzi" msgid "TileMatrixSet" msgstr "Matrica tile-ova" +msgid "This document as JSON" +msgstr "" + +msgid "This document as RDF (JSON-LD)" +msgstr "" + +msgid "This document as HTML" +msgstr "" + +msgid "The OpenAPI definition as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as HTML" +msgstr "" + +msgid "The landing page of this server as JSON" +msgstr "" + +msgid "The landing page of this server as HTML" +msgstr "" + +msgid "Schema of collection in JSON" +msgstr "" + +msgid "Schema of collection in HTML" +msgstr "" + +msgid "Queryables for this collection as JSON" +msgstr "" + +msgid "Queryables for this collection as HTML" +msgstr "" + +msgid "Items as GeoJSON" +msgstr "" + +msgid "Items as HTML" +msgstr "" + +msgid "Items as RDF (GeoJSON-LD)" +msgstr "" + +msgid "Coverage data" +msgstr "" + +msgid "Coverage data as" +msgstr "" + +msgid "Tiles as HTML" +msgstr "" + +msgid "Tiles as JSON" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "query for this collection as JSON" +msgstr "" + +msgid "Items (prev)" +msgstr "" + +msgid "Items (next)" +msgstr "" + +msgid "Process description as JSON" +msgstr "" + +msgid "Process description as HTML" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "Execution for process as JSON" +msgstr "" + +msgid "Jobs list as JSON" +msgstr "" + +msgid "Jobs list as HTML" +msgstr "" + +msgid "Results of job as JSON" +msgstr "" + +msgid "Results of job as HTML" +msgstr "" + +msgid "The job list for the current process" +msgstr "" + +msgid "TileMatrixSet definition in JSON" +msgstr "" diff --git a/locale/de/LC_MESSAGES/messages.po b/locale/de/LC_MESSAGES/messages.po index a47e6a6..9313773 100644 --- a/locale/de/LC_MESSAGES/messages.po +++ b/locale/de/LC_MESSAGES/messages.po @@ -584,3 +584,101 @@ msgstr "Ergebnis" msgid "Results of job" msgstr "Ergebnis des Auftrags" +msgid "This document as JSON" +msgstr "" + +msgid "This document as RDF (JSON-LD)" +msgstr "" + +msgid "This document as HTML" +msgstr "" + +msgid "The OpenAPI definition as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as HTML" +msgstr "" + +msgid "The landing page of this server as JSON" +msgstr "" + +msgid "The landing page of this server as HTML" +msgstr "" + +msgid "Schema of collection in JSON" +msgstr "" + +msgid "Schema of collection in HTML" +msgstr "" + +msgid "Queryables for this collection as JSON" +msgstr "" + +msgid "Queryables for this collection as HTML" +msgstr "" + +msgid "Items as GeoJSON" +msgstr "" + +msgid "Items as HTML" +msgstr "" + +msgid "Items as RDF (GeoJSON-LD)" +msgstr "" + +msgid "Coverage data" +msgstr "" + +msgid "Coverage data as" +msgstr "" + +msgid "Tiles as HTML" +msgstr "" + +msgid "Tiles as JSON" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "query for this collection as JSON" +msgstr "" + +msgid "Items (prev)" +msgstr "" + +msgid "Items (next)" +msgstr "" + +msgid "Process description as JSON" +msgstr "" + +msgid "Process description as HTML" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "Execution for process as JSON" +msgstr "" + +msgid "Jobs list as JSON" +msgstr "" + +msgid "Jobs list as HTML" +msgstr "" + +msgid "Results of job as JSON" +msgstr "" + +msgid "Results of job as HTML" +msgstr "" + +msgid "The job list for the current process" +msgstr "" + +msgid "TileMatrixSet definition in JSON" +msgstr "" diff --git a/locale/en/LC_MESSAGES/messages.po b/locale/en/LC_MESSAGES/messages.po index e3ed1ce..f8d342a 100644 --- a/locale/en/LC_MESSAGES/messages.po +++ b/locale/en/LC_MESSAGES/messages.po @@ -586,3 +586,101 @@ msgstr "" #~ msgid "Powered by" #~ msgstr "" +msgid "This document as JSON" +msgstr "" + +msgid "This document as RDF (JSON-LD)" +msgstr "" + +msgid "This document as HTML" +msgstr "" + +msgid "The OpenAPI definition as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as HTML" +msgstr "" + +msgid "The landing page of this server as JSON" +msgstr "" + +msgid "The landing page of this server as HTML" +msgstr "" + +msgid "Schema of collection in JSON" +msgstr "" + +msgid "Schema of collection in HTML" +msgstr "" + +msgid "Queryables for this collection as JSON" +msgstr "" + +msgid "Queryables for this collection as HTML" +msgstr "" + +msgid "Items as GeoJSON" +msgstr "" + +msgid "Items as HTML" +msgstr "" + +msgid "Items as RDF (GeoJSON-LD)" +msgstr "" + +msgid "Coverage data" +msgstr "" + +msgid "Coverage data as" +msgstr "" + +msgid "Tiles as HTML" +msgstr "" + +msgid "Tiles as JSON" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "query for this collection as JSON" +msgstr "" + +msgid "Items (prev)" +msgstr "" + +msgid "Items (next)" +msgstr "" + +msgid "Process description as JSON" +msgstr "" + +msgid "Process description as HTML" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "Execution for process as JSON" +msgstr "" + +msgid "Jobs list as JSON" +msgstr "" + +msgid "Jobs list as HTML" +msgstr "" + +msgid "Results of job as JSON" +msgstr "" + +msgid "Results of job as HTML" +msgstr "" + +msgid "The job list for the current process" +msgstr "" + +msgid "TileMatrixSet definition in JSON" +msgstr "" diff --git a/locale/fr/LC_MESSAGES/messages.po b/locale/fr/LC_MESSAGES/messages.po index 364e441..9247455 100644 --- a/locale/fr/LC_MESSAGES/messages.po +++ b/locale/fr/LC_MESSAGES/messages.po @@ -593,3 +593,101 @@ msgstr "" msgid "Results of job" msgstr "" +msgid "This document as JSON" +msgstr "" + +msgid "This document as RDF (JSON-LD)" +msgstr "" + +msgid "This document as HTML" +msgstr "" + +msgid "The OpenAPI definition as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as HTML" +msgstr "" + +msgid "The landing page of this server as JSON" +msgstr "" + +msgid "The landing page of this server as HTML" +msgstr "" + +msgid "Schema of collection in JSON" +msgstr "" + +msgid "Schema of collection in HTML" +msgstr "" + +msgid "Queryables for this collection as JSON" +msgstr "" + +msgid "Queryables for this collection as HTML" +msgstr "" + +msgid "Items as GeoJSON" +msgstr "" + +msgid "Items as HTML" +msgstr "" + +msgid "Items as RDF (GeoJSON-LD)" +msgstr "" + +msgid "Coverage data" +msgstr "" + +msgid "Coverage data as" +msgstr "" + +msgid "Tiles as HTML" +msgstr "" + +msgid "Tiles as JSON" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "query for this collection as JSON" +msgstr "" + +msgid "Items (prev)" +msgstr "" + +msgid "Items (next)" +msgstr "" + +msgid "Process description as JSON" +msgstr "" + +msgid "Process description as HTML" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "Execution for process as JSON" +msgstr "" + +msgid "Jobs list as JSON" +msgstr "" + +msgid "Jobs list as HTML" +msgstr "" + +msgid "Results of job as JSON" +msgstr "" + +msgid "Results of job as HTML" +msgstr "" + +msgid "The job list for the current process" +msgstr "" + +msgid "TileMatrixSet definition in JSON" +msgstr "" diff --git a/locale/sr/LC_MESSAGES/messages.po b/locale/sr/LC_MESSAGES/messages.po index 4f3d358..9c898d6 100644 --- a/locale/sr/LC_MESSAGES/messages.po +++ b/locale/sr/LC_MESSAGES/messages.po @@ -534,3 +534,101 @@ msgstr "Matrice skupova tile-ova dostupne u ovom servisu" msgid "TileMatrixSet" msgstr "Matrica skupa tile-ova" +msgid "This document as JSON" +msgstr "" + +msgid "This document as RDF (JSON-LD)" +msgstr "" + +msgid "This document as HTML" +msgstr "" + +msgid "The OpenAPI definition as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as JSON" +msgstr "" + +msgid "The list of supported tiling schemes as HTML" +msgstr "" + +msgid "The landing page of this server as JSON" +msgstr "" + +msgid "The landing page of this server as HTML" +msgstr "" + +msgid "Schema of collection in JSON" +msgstr "" + +msgid "Schema of collection in HTML" +msgstr "" + +msgid "Queryables for this collection as JSON" +msgstr "" + +msgid "Queryables for this collection as HTML" +msgstr "" + +msgid "Items as GeoJSON" +msgstr "" + +msgid "Items as HTML" +msgstr "" + +msgid "Items as RDF (GeoJSON-LD)" +msgstr "" + +msgid "Coverage data" +msgstr "" + +msgid "Coverage data as" +msgstr "" + +msgid "Tiles as HTML" +msgstr "" + +msgid "Tiles as JSON" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "query for this collection as JSON" +msgstr "" + +msgid "Items (prev)" +msgstr "" + +msgid "Items (next)" +msgstr "" + +msgid "Process description as JSON" +msgstr "" + +msgid "Process description as HTML" +msgstr "" + +msgid "query for this collection as HTML" +msgstr "" + +msgid "Execution for process as JSON" +msgstr "" + +msgid "Jobs list as JSON" +msgstr "" + +msgid "Jobs list as HTML" +msgstr "" + +msgid "Results of job as JSON" +msgstr "" + +msgid "Results of job as HTML" +msgstr "" + +msgid "The job list for the current process" +msgstr "" + +msgid "TileMatrixSet definition in JSON" +msgstr "" diff --git a/pygeoapi/api/__init__.py b/pygeoapi/api/__init__.py index 0d11c35..e764db2 100644 --- a/pygeoapi/api/__init__.py +++ b/pygeoapi/api/__init__.py @@ -715,59 +715,59 @@ class API: fcm['links'] = [{ 'rel': request.get_linkrel(F_JSON), 'type': FORMAT_TYPES[F_JSON], - 'title': 'This document as JSON', + 'title': l10n.translate('This document as JSON', request.locale), 'href': f"{self.base_url}?f={F_JSON}" }, { 'rel': request.get_linkrel(F_JSONLD), 'type': FORMAT_TYPES[F_JSONLD], - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f"{self.base_url}?f={F_JSONLD}" }, { 'rel': request.get_linkrel(F_HTML), 'type': FORMAT_TYPES[F_HTML], - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), 'href': f"{self.base_url}?f={F_HTML}", 'hreflang': self.default_locale }, { 'rel': 'service-desc', 'type': 'application/vnd.oai.openapi+json;version=3.0', - 'title': 'The OpenAPI definition as JSON', + 'title': l10n.translate('The OpenAPI definition as JSON', request.locale), # noqa 'href': f"{self.base_url}/openapi" }, { 'rel': 'service-doc', 'type': FORMAT_TYPES[F_HTML], - 'title': 'The OpenAPI definition as HTML', + 'title': l10n.translate('The OpenAPI definition as HTML', request.locale), # noqa 'href': f"{self.base_url}/openapi?f={F_HTML}", 'hreflang': self.default_locale }, { 'rel': 'conformance', 'type': FORMAT_TYPES[F_JSON], - 'title': 'Conformance', + 'title': l10n.translate('Conformance', request.locale), 'href': f"{self.base_url}/conformance" }, { 'rel': 'data', 'type': FORMAT_TYPES[F_JSON], - 'title': 'Collections', + 'title': l10n.translate('Collections', request.locale), 'href': self.get_collections_url() }, { 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/processes', 'type': FORMAT_TYPES[F_JSON], - 'title': 'Processes', + 'title': l10n.translate('Processes', request.locale), 'href': f"{self.base_url}/processes" }, { 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list', 'type': FORMAT_TYPES[F_JSON], - 'title': 'Jobs', + 'title': l10n.translate('Jobs', request.locale), 'href': f"{self.base_url}/jobs" }, { 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/tiling-schemes', 'type': FORMAT_TYPES[F_JSON], - 'title': 'The list of supported tiling schemes (as JSON)', + 'title': l10n.translate('The list of supported tiling schemes as JSON', request.locale), # noqa 'href': f"{self.base_url}/TileMatrixSets?f=json" }, { 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/tiling-schemes', 'type': FORMAT_TYPES[F_HTML], - 'title': 'The list of supported tiling schemes (as HTML)', + 'title': l10n.translate('The list of supported tiling schemes as HTML', request.locale), # noqa 'href': f"{self.base_url}/TileMatrixSets?f=html" }] @@ -1011,31 +1011,31 @@ class API: collection['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': 'root', - 'title': 'The landing page of this server as JSON', + 'title': l10n.translate('The landing page of this server as JSON', request.locale), # noqa 'href': f"{self.base_url}?f={F_JSON}" }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': 'root', - 'title': 'The landing page of this server as HTML', + 'title': l10n.translate('The landing page of this server as HTML', request.locale), # noqa 'href': f"{self.base_url}?f={F_HTML}" }) collection['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': request.get_linkrel(F_JSON), - 'title': 'This document as JSON', + 'title': l10n.translate('This document as JSON', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}?f={F_JSON}' }) collection['links'].append({ 'type': FORMAT_TYPES[F_JSONLD], 'rel': request.get_linkrel(F_JSONLD), - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}?f={F_JSONLD}' }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': request.get_linkrel(F_HTML), - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}?f={F_HTML}' }) @@ -1043,13 +1043,13 @@ class API: collection['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': f'{OGC_RELTYPES_BASE}/schema', - 'title': 'Schema of collection in JSON', + 'title': l10n.translate('Schema of collection in JSON', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/schema?f={F_JSON}' # noqa }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': f'{OGC_RELTYPES_BASE}/schema', - 'title': 'Schema of collection in HTML', + 'title': l10n.translate('Schema of collection in HTML', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/schema?f={F_HTML}' # noqa }) @@ -1060,31 +1060,31 @@ class API: collection['links'].append({ 'type': 'application/schema+json', 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/queryables', - 'title': 'Queryables for this collection as JSON', + 'title': l10n.translate('Queryables for this collection as JSON', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/queryables?f={F_JSON}' # noqa }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/queryables', - 'title': 'Queryables for this collection as HTML', + 'title': l10n.translate('Queryables for this collection as HTML', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/queryables?f={F_HTML}' # noqa }) collection['links'].append({ 'type': 'application/geo+json', 'rel': 'items', - 'title': 'items as GeoJSON', + 'title': l10n.translate('Items as GeoJSON', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/items?f={F_JSON}' # noqa }) collection['links'].append({ 'type': FORMAT_TYPES[F_JSONLD], 'rel': 'items', - 'title': 'items as RDF (GeoJSON-LD)', + 'title': l10n.translate('Items as RDF (GeoJSON-LD)', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/items?f={F_JSONLD}' # noqa }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': 'items', - 'title': 'Items as HTML', + 'title': l10n.translate('Items as HTML', request.locale), # noqa 'href': f'{self.get_collections_url()}/{k}/items?f={F_HTML}' # noqa }) @@ -1101,14 +1101,16 @@ class API: collection['links'].append({ 'type': 'application/prs.coverage+json', 'rel': f'{OGC_RELTYPES_BASE}/coverage', - 'title': 'Coverage data', + 'title': l10n.translate('Coverage data', request.locale), 'href': f'{self.get_collections_url()}/{k}/coverage?f={F_JSON}' # noqa }) if collection_data_format is not None: + title_ = l10n.translate('Coverage data as', request.locale) # noqa + title_ = f"{title_} {collection_data_format['name']}" collection['links'].append({ 'type': collection_data_format['mimetype'], 'rel': f'{OGC_RELTYPES_BASE}/coverage', - 'title': f"Coverage data as {collection_data_format['name']}", # noqa + 'title': title_, 'href': f"{self.get_collections_url()}/{k}/coverage?f={collection_data_format['name']}" # noqa }) if dataset is not None: @@ -1154,13 +1156,13 @@ class API: collection['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': f'http://www.opengis.net/def/rel/ogc/1.0/tilesets-{p.tile_type}', # noqa - 'title': 'Tiles as JSON', + 'title': l10n.translate('Tiles as JSON', request.locale), 'href': f'{self.get_collections_url()}/{k}/tiles?f={F_JSON}' # noqa }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': f'http://www.opengis.net/def/rel/ogc/1.0/tilesets-{p.tile_type}', # noqa - 'title': 'Tiles as HTML', + 'title': l10n.translate('Tiles as HTML', request.locale), 'href': f'{self.get_collections_url()}/{k}/tiles?f={F_HTML}' # noqa }) @@ -1175,10 +1177,13 @@ class API: map_mimetype = map_['format']['mimetype'] map_format = map_['format']['name'] + title_ = l10n.translate('Map as', request.locale) + title_ = f"{title_} {map_format}" + collection['links'].append({ 'type': map_mimetype, 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/map', - 'title': f'Map as {map_format}', + 'title': title_, 'href': f"{self.get_collections_url()}/{k}/map?f={map_format}" # noqa }) @@ -1216,16 +1221,21 @@ class API: } for qt in p.get_query_types(): + title1 = l10n.translate('query for this collection as JSON', request.locale) # noqa + title1 = f'{qt} {title1}' + title2 = l10n.translate('query for this collection as HTML', request.locale) # noqa + title2 = f'{qt} {title2}' + collection['links'].append({ 'type': 'application/json', 'rel': 'data', - 'title': f'{qt} query for this collection as JSON', + 'title': title1, 'href': f'{self.get_collections_url()}/{k}/{qt}?f={F_JSON}' # noqa }) collection['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': 'data', - 'title': f'{qt} query for this collection as HTML', + 'title': title2, 'href': f'{self.get_collections_url()}/{k}/{qt}?f={F_HTML}' # noqa }) @@ -1240,19 +1250,19 @@ class API: fcm['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': request.get_linkrel(F_JSON), - 'title': 'This document as JSON', + 'title': l10n.translate('This document as JSON', request.locale), # noqa 'href': f'{self.get_collections_url()}?f={F_JSON}' }) fcm['links'].append({ 'type': FORMAT_TYPES[F_JSONLD], 'rel': request.get_linkrel(F_JSONLD), - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f'{self.get_collections_url()}?f={F_JSONLD}' }) fcm['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': request.get_linkrel(F_HTML), - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), # noqa 'href': f'{self.get_collections_url()}?f={F_HTML}' }) diff --git a/pygeoapi/api/itemtypes.py b/pygeoapi/api/itemtypes.py index 4a74606..76cf04e 100644 --- a/pygeoapi/api/itemtypes.py +++ b/pygeoapi/api/itemtypes.py @@ -509,17 +509,17 @@ def get_collection_items( content['links'] = [{ 'type': 'application/geo+json', 'rel': request.get_linkrel(F_JSON), - 'title': 'This document as GeoJSON', + 'title': l10n.translate('This document as GeoJSON', request.locale), 'href': f'{uri}?f={F_JSON}{serialized_query_params}' }, { 'rel': request.get_linkrel(F_JSONLD), 'type': FORMAT_TYPES[F_JSONLD], - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f'{uri}?f={F_JSONLD}{serialized_query_params}' }, { 'type': FORMAT_TYPES[F_HTML], 'rel': request.get_linkrel(F_HTML), - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), 'href': f'{uri}?f={F_HTML}{serialized_query_params}' }] @@ -529,7 +529,7 @@ def get_collection_items( { 'type': 'application/geo+json', 'rel': 'prev', - 'title': 'items (prev)', + 'title': l10n.translate('Items (prev)', request.locale), 'href': f'{uri}?offset={prev}{serialized_query_params}' }) @@ -541,7 +541,7 @@ def get_collection_items( { 'type': 'application/geo+json', 'rel': 'next', - 'title': 'items (next)', + 'title': l10n.translate('Items (next)', request.locale), 'href': next_href }) @@ -1125,27 +1125,27 @@ def get_collection_item(api: API, request: APIRequest, content['links'].extend([{ 'type': FORMAT_TYPES[F_JSON], 'rel': 'root', - 'title': 'The landing page of this server as JSON', + 'title': l10n.translate('The landing page of this server as JSON', request.locale), # noqa 'href': f"{api.base_url}?f={F_JSON}" }, { 'type': FORMAT_TYPES[F_HTML], 'rel': 'root', - 'title': 'The landing page of this server as HTML', + 'title': l10n.translate('The landing page of this server as HTML', request.locale), # noqa 'href': f"{api.base_url}?f={F_HTML}" }, { 'rel': request.get_linkrel(F_JSON), 'type': 'application/geo+json', - 'title': 'This document as GeoJSON', + 'title': l10n.translate('This document as JSON', request.locale), 'href': f'{uri}?f={F_JSON}' }, { 'rel': request.get_linkrel(F_JSONLD), 'type': FORMAT_TYPES[F_JSONLD], - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f'{uri}?f={F_JSONLD}' }, { 'rel': request.get_linkrel(F_HTML), 'type': FORMAT_TYPES[F_HTML], - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), 'href': f'{uri}?f={F_HTML}' }, { 'rel': 'collection', diff --git a/pygeoapi/api/processes.py b/pygeoapi/api/processes.py index 7cb96ec..3cbdc33 100644 --- a/pygeoapi/api/processes.py +++ b/pygeoapi/api/processes.py @@ -142,7 +142,7 @@ def describe_processes(api: API, request: APIRequest, 'type': FORMAT_TYPES[F_JSON], 'rel': request.get_linkrel(F_JSON), 'href': f'{process_url}?f={F_JSON}', - 'title': 'Process description as JSON', + 'title': l10n.translate('Process description as JSON', request.locale), # noqa 'hreflang': api.default_locale } p2['links'].append(link) @@ -151,7 +151,7 @@ def describe_processes(api: API, request: APIRequest, 'type': FORMAT_TYPES[F_HTML], 'rel': request.get_linkrel(F_HTML), 'href': f'{process_url}?f={F_HTML}', - 'title': 'Process description as HTML', + 'title': l10n.translate('Process description as HTML', request.locale), # noqa 'hreflang': api.default_locale } p2['links'].append(link) @@ -160,7 +160,7 @@ def describe_processes(api: API, request: APIRequest, 'type': FORMAT_TYPES[F_HTML], 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list', 'href': f'{jobs_url}?f={F_HTML}', - 'title': 'jobs for this process as HTML', + 'title': l10n.translate('Jobs for this process as HTML', request.locale), # noqa 'hreflang': api.default_locale } p2['links'].append(link) @@ -169,7 +169,7 @@ def describe_processes(api: API, request: APIRequest, 'type': FORMAT_TYPES[F_JSON], 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/job-list', 'href': f'{jobs_url}?f={F_JSON}', - 'title': 'jobs for this process as JSON', + 'title': l10n.translate('Jobs for this process as HTML', request.locale), # noqa 'hreflang': api.default_locale } p2['links'].append(link) @@ -178,7 +178,7 @@ def describe_processes(api: API, request: APIRequest, 'type': FORMAT_TYPES[F_JSON], 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/execute', 'href': f'{process_url}/execution?f={F_JSON}', - 'title': 'Execution for this process as JSON', + 'title': l10n.translate('Execution for this process as JSON', request.locale), # noqa 'hreflang': api.default_locale } p2['links'].append(link) @@ -194,17 +194,17 @@ def describe_processes(api: API, request: APIRequest, 'links': [{ 'type': FORMAT_TYPES[F_JSON], 'rel': request.get_linkrel(F_JSON), - 'title': 'This document as JSON', + 'title': l10n.translate('This document as JSON', request.locale), # noqa 'href': f'{process_url}?f={F_JSON}' }, { 'type': FORMAT_TYPES[F_JSONLD], 'rel': request.get_linkrel(F_JSONLD), - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f'{process_url}?f={F_JSONLD}' }, { 'type': FORMAT_TYPES[F_HTML], 'rel': request.get_linkrel(F_HTML), - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), # noqa 'href': f'{process_url}?f={F_HTML}' }] } @@ -256,12 +256,12 @@ def get_jobs(api: API, request: APIRequest, 'href': f"{api.base_url}/jobs?f={F_HTML}", 'rel': request.get_linkrel(F_HTML), 'type': FORMAT_TYPES[F_HTML], - 'title': 'Jobs list as HTML' + 'title': l10n.translate('Jobs list as HTML', request.locale) }, { 'href': f"{api.base_url}/jobs?f={F_JSON}", 'rel': request.get_linkrel(F_JSON), 'type': FORMAT_TYPES[F_JSON], - 'title': 'Jobs list as JSON' + 'title': l10n.translate('Jobs list as JSON', request.locale) }] } for job_ in jobs: @@ -287,12 +287,12 @@ def get_jobs(api: API, request: APIRequest, 'href': f'{job_result_url}?f={F_HTML}', 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/results', 'type': FORMAT_TYPES[F_HTML], - 'title': f'results of job {job_id} as HTML' + 'title': l10n.translate(f'Results of job as HTML', request.locale), # noqa }, { 'href': f'{job_result_url}?f={F_JSON}', 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/results', 'type': FORMAT_TYPES[F_JSON], - 'title': f'results of job {job_id} as JSON' + 'title': l10n.translate(f'Results of job as JSON', request.locale), # noqa }] if job_['mimetype'] not in (FORMAT_TYPES[F_JSON], @@ -302,7 +302,7 @@ def get_jobs(api: API, request: APIRequest, 'href': job_result_url, 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/results', # noqa 'type': job_['mimetype'], - 'title': f"results of job {job_id} as {job_['mimetype']}" # noqa + 'title': f"Results of job {job_id} as {job_['mimetype']}" # noqa }) serialized_jobs['jobs'].append(job2) @@ -541,7 +541,7 @@ def delete_job( 'href': jobs_url, 'rel': 'up', 'type': FORMAT_TYPES[F_JSON], - 'title': 'The job list for the current process' + 'title': l10n.translate('The job list for the current process', request.locale) # noqa }] } else: diff --git a/pygeoapi/api/tiles.py b/pygeoapi/api/tiles.py index 5f6dd5f..529723f 100644 --- a/pygeoapi/api/tiles.py +++ b/pygeoapi/api/tiles.py @@ -116,19 +116,19 @@ def get_collection_tiles(api: API, request: APIRequest, tiles['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': request.get_linkrel(F_JSON), - 'title': 'This document as JSON', + 'title': l10n.translate('This document as JSON', request.locale), 'href': f'{api.get_collections_url()}/{dataset}/tiles?f={F_JSON}' }) tiles['links'].append({ 'type': FORMAT_TYPES[F_JSONLD], 'rel': request.get_linkrel(F_JSONLD), - 'title': 'This document as RDF (JSON-LD)', + 'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa 'href': f'{api.get_collections_url()}/{dataset}/tiles?f={F_JSONLD}' }) tiles['links'].append({ 'type': FORMAT_TYPES[F_HTML], 'rel': request.get_linkrel(F_HTML), - 'title': 'This document as HTML', + 'title': l10n.translate('This document as HTML', request.locale), 'href': f'{api.get_collections_url()}/{dataset}/tiles?f={F_HTML}' }) @@ -153,7 +153,7 @@ def get_collection_tiles(api: API, request: APIRequest, tile_matrix['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme', - 'title': f'{matrix.tileMatrixSet} TileMatrixSet definition (as {F_JSON})', # noqa + 'title': l10n.translate('TileMatrixSet definition in JSON', request.locale), # noqa 'href': f'{api.base_url}/TileMatrixSets/{matrix.tileMatrixSet}?f={F_JSON}' # noqa }) tile_matrix['links'].append({ @@ -370,12 +370,12 @@ def tilematrixsets(api: API, tms['links'] = [{ "rel": "alternate", "type": "text/html", - "title": "This document as HTML", + "title": l10n.translate('This document as HTML', request.locale), "href": f"{api.base_url}/tileMatrixSets?f=html" }, { "rel": "self", "type": "application/json", - "title": "This document", + "title": l10n.translate('This document as JSON', request.locale), "href": f"{api.base_url}/tileMatrixSets?f=json" }]