From f23d3ddb7e1763f79af71b9b387d6ebcd148fb20 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Fri, 26 Jul 2024 16:50:17 +0900 Subject: [PATCH 01/17] Add links to tile provider authentication docs --- src/components/ModalExport.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/ModalExport.tsx b/src/components/ModalExport.tsx index 2806106b..8c33bd8e 100644 --- a/src/components/ModalExport.tsx +++ b/src/components/ModalExport.tsx @@ -113,6 +113,13 @@ export default class ModalExport extends React.Component {

Download a JSON style to your computer.

+

+ MapTiler,  + ThunderForest, + and Stadia Maps  + may require access keys or other authentication to access map tiles. + Refer to their documentation for details. +

Date: Wed, 28 Aug 2024 14:29:48 +0900 Subject: [PATCH 02/17] Support exporting Stadia Maps API keys with styles --- cypress/e2e/modals.cy.ts | 12 ++++++++++++ src/components/ModalExport.tsx | 6 ++++++ src/components/ModalSettings.tsx | 8 ++++++++ src/libs/field-spec-additional.ts | 4 ++++ src/libs/style.ts | 27 +++++++++++++++++++++------ 5 files changed, 51 insertions(+), 6 deletions(-) diff --git a/cypress/e2e/modals.cy.ts b/cypress/e2e/modals.cy.ts index ec3e4d77..02cb244f 100644 --- a/cypress/e2e/modals.cy.ts +++ b/cypress/e2e/modals.cy.ts @@ -160,6 +160,18 @@ describe("modals", () => { ).shouldInclude({ "maputnik:thunderforest_access_token": apiKey }); }); + it("stadia access token", () => { + let apiKey = "testing123"; + when.setValue( + "modal:settings.maputnik:stadia_access_token", + apiKey + ); + when.click("modal:settings.name"); + then( + get.styleFromLocalStorage().then((style) => style.metadata) + ).shouldInclude({ "maputnik:stadia_access_token": apiKey }); + }); + it("style renderer", () => { cy.on("uncaught:exception", () => false); // this is due to the fact that this is an invalid style for openlayers when.select("modal:settings.maputnik:renderer", "ol"); diff --git a/src/components/ModalExport.tsx b/src/components/ModalExport.tsx index bc75e172..f3c85783 100644 --- a/src/components/ModalExport.tsx +++ b/src/components/ModalExport.tsx @@ -137,6 +137,12 @@ class ModalExportInternal extends React.Component { value={(this.props.mapStyle.metadata || {} as any)['maputnik:thunderforest_access_token']} onChange={this.changeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")} /> +
diff --git a/src/components/ModalSettings.tsx b/src/components/ModalSettings.tsx index 1989c4c8..991e8804 100644 --- a/src/components/ModalSettings.tsx +++ b/src/components/ModalSettings.tsx @@ -156,6 +156,14 @@ class ModalSettingsInternal extends React.Component onChange={onChangeMetadataProperty.bind(this, "maputnik:thunderforest_access_token")} /> + + ({ label: t("Thunderforest Access Token"), doc: t("Public access token for Thunderforest services.") }, + stadia_access_token: { + label: t("Stadia Maps API Key"), + doc: t("API key for Stadia Maps.") + }, style_renderer: { label: t("Style Renderer"), doc: t("Choose the default Maputnik renderer for this style."), diff --git a/src/libs/style.ts b/src/libs/style.ts index 1c71ae93..9192582b 100644 --- a/src/libs/style.ts +++ b/src/libs/style.ts @@ -55,10 +55,6 @@ function indexOfLayer(layers: LayerSpecification[], layerId: string) { } function getAccessToken(sourceName: string, mapStyle: StyleSpecification, opts: {allowFallback?: boolean}) { - if(sourceName === "thunderforest_transport" || sourceName === "thunderforest_outdoors") { - sourceName = "thunderforest" - } - const metadata = mapStyle.metadata || {} as any; let accessToken = metadata[`maputnik:${sourceName}_access_token`] @@ -74,7 +70,24 @@ function replaceSourceAccessToken(mapStyle: StyleSpecification, sourceName: stri if(!source) return mapStyle if(!("url" in source) || !source.url) return mapStyle - const accessToken = getAccessToken(sourceName, mapStyle, opts) + let authSourceName = sourceName + let setAccessToken = (url: string) => url.replace('{key}', accessToken) + if(sourceName === "thunderforest_transport" || sourceName === "thunderforest_outdoors") { + authSourceName = "thunderforest" + } + else if (("url" in source) && source.url?.match(/\.stadiamaps\.com/)) { + // A few weird things here worth commenting on... + // + // 1. The code currently assumes openmaptiles == MapTiler, + // so we need to check the source URL. + // 2. Stadia Maps does not always require an API key, + // so there is no placeholder in our styles. + // We append it at the end during exporting if necessary. + authSourceName = "stadia" + setAccessToken = (url: string) => `${url}?api_key=${accessToken}` + } + + const accessToken = getAccessToken(authSourceName, mapStyle, opts) if(!accessToken) { // Early exit. @@ -85,7 +98,7 @@ function replaceSourceAccessToken(mapStyle: StyleSpecification, sourceName: stri ...mapStyle.sources, [sourceName]: { ...source, - url: source.url.replace('{key}', accessToken) + url: setAccessToken(source.url) } } const changedStyle = { @@ -120,6 +133,8 @@ function stripAccessTokens(mapStyle: StyleSpecification) { ...mapStyle.metadata as any }; delete changedMetadata['maputnik:openmaptiles_access_token']; + delete changedMetadata['maputnik:thunderforest_access_token']; + delete changedMetadata['maputnik:stadia_access_token']; return { ...mapStyle, metadata: changedMetadata From f95e814fe53e5bd7a956da4ace4695bffc20d034 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Wed, 28 Aug 2024 14:35:30 +0900 Subject: [PATCH 03/17] Add translations --- README.md | 6 ++++++ src/locales/he/translation.json | 2 ++ src/locales/ja/translation.json | 2 ++ src/locales/zh/translation.json | 5 ++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cc7bae53..5ca2606a 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,12 @@ npm run lint-css npm run sort-styles ``` +Update the translation files (run this whenever touching user-facing strings). +After running, check your working copy for files and add/correct as needed. + +``` +npm run i18n:refresh +``` ## Tests For E2E testing we use [Cypress](https://www.cypress.io/) diff --git a/src/locales/he/translation.json b/src/locales/he/translation.json index b11f26cd..3e6415f2 100644 --- a/src/locales/he/translation.json +++ b/src/locales/he/translation.json @@ -179,6 +179,8 @@ "Public access token for MapTiler Cloud.": "Public access token for MapTiler Cloud.", "Thunderforest Access Token": "Thunderforest Access Token", "Public access token for Thunderforest services.": "Public access token for Thunderforest services.", + "Stadia Maps API Key": "Stadia Maps API Key", + "API key for Stadia Maps.": "API key for Stadia Maps", "Style Renderer": "צייר הסטייל", "Choose the default Maputnik renderer for this style.": "בחירת צייר ברירת המחדל של מפוטניק עבור הסטייל הזה" } diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json index 31751a81..52f92a31 100644 --- a/src/locales/ja/translation.json +++ b/src/locales/ja/translation.json @@ -179,6 +179,8 @@ "Public access token for MapTiler Cloud.": "MapTiler Cloud の公開用アクセストークン", "Thunderforest Access Token": "Thunderforest アクセストークン", "Public access token for Thunderforest services.": "Thunderforest サービスの公開用アクセストークン", + "Stadia Maps API Key": "Stadia Maps API キー", + "API key for Stadia Maps.": "Stadia Maps の API キー", "Style Renderer": "スタイルレンダラ", "Choose the default Maputnik renderer for this style.": "このスタイルのデフォルトの Maputnik レンダラを選択してください", "Layer options": "レイヤー設定", diff --git a/src/locales/zh/translation.json b/src/locales/zh/translation.json index dd26994b..1e1cfca5 100644 --- a/src/locales/zh/translation.json +++ b/src/locales/zh/translation.json @@ -82,7 +82,7 @@ "Close modal": "关闭模态框", "Debug": "调试", "Options": "选项", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图", "Export Style": "导出样式", "Download Style": "下载样式", "Download a JSON style to your computer.": "将JSON样式下载到您的电脑。", @@ -179,8 +179,11 @@ "Public access token for MapTiler Cloud.": "MapTiler Cloud 的公共访问令牌。", "Thunderforest Access Token": "Thunderforest 访问令牌", "Public access token for Thunderforest services.": "Thunderforest 服务的公共访问令牌。", + "Stadia Maps API Key": "Stadia Maps API 密钥", + "API key for Stadia Maps.": "Stadia Maps 的 API 密钥", "Style Renderer": "样式渲染器", "Choose the default Maputnik renderer for this style.": "为这种样式选择默认的Maputnik渲染器。", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图", "Layer options": "图层选项", "Paint properties": "绘制属性", "Layout properties": "布局属性", From 25fc5942260c541bea390eb8fd3372c0b1773477 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Wed, 28 Aug 2024 22:49:48 +0900 Subject: [PATCH 04/17] Localization clean-up + documentation --- README.md | 4 ++++ src/locales/he/translation.json | 2 +- src/locales/ja/translation.json | 2 +- src/locales/zh/translation.json | 1 - 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5ca2606a..785e546a 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ After running, check your working copy for files and add/correct as needed. npm run i18n:refresh ``` +You can test the UI in different languages using the dropdown in the top menu +(Maputnik does not automatically localize based on browser language settings +at the moment). + ## Tests For E2E testing we use [Cypress](https://www.cypress.io/) diff --git a/src/locales/he/translation.json b/src/locales/he/translation.json index 3e6415f2..3ac5fb5f 100644 --- a/src/locales/he/translation.json +++ b/src/locales/he/translation.json @@ -82,7 +82,7 @@ "Close modal": "סגירת חלונית", "Debug": "דיבאג", "Options": "אפשרויות", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "<0>פתיחה ב-OSM - פתיחה של התצוגה הנוכחית ב- openstreetmap.org", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "<0>פתיחה ב-OSM - פתיחה של התצוגה הנוכחית ב- openstreetmap.org", "Export Style": "ייצוא של הסטייל", "Download Style": "הורדה של הסטייל", "Download a JSON style to your computer.": "הורדה של הסטייל למחשב", diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json index 52f92a31..6f9f1b50 100644 --- a/src/locales/ja/translation.json +++ b/src/locales/ja/translation.json @@ -82,7 +82,7 @@ "Close modal": "モーダルを閉じる", "Debug": "デバッグ", "Options": "設定", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "現在のビューを <0>openstreetmap.org で開く", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "現在のビューを <0>openstreetmap.org で開く", "Export Style": "スタイルをエクスポート", "Download Style": "スタイルをダウンロード", "Download a JSON style to your computer.": "パソコンにJSONスタイルをダウンロードします。", diff --git a/src/locales/zh/translation.json b/src/locales/zh/translation.json index 1e1cfca5..aaf9e225 100644 --- a/src/locales/zh/translation.json +++ b/src/locales/zh/translation.json @@ -82,7 +82,6 @@ "Close modal": "关闭模态框", "Debug": "调试", "Options": "选项", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图", "Export Style": "导出样式", "Download Style": "下载样式", "Download a JSON style to your computer.": "将JSON样式下载到您的电脑。", From 91600f88c5d297aec3df0f3978f8328fe25d46a0 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Wed, 28 Aug 2024 23:30:16 +0900 Subject: [PATCH 05/17] Refactor based on code review suggestion --- src/libs/style.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/libs/style.ts b/src/libs/style.ts index 9192582b..750f488b 100644 --- a/src/libs/style.ts +++ b/src/libs/style.ts @@ -71,20 +71,13 @@ function replaceSourceAccessToken(mapStyle: StyleSpecification, sourceName: stri if(!("url" in source) || !source.url) return mapStyle let authSourceName = sourceName - let setAccessToken = (url: string) => url.replace('{key}', accessToken) if(sourceName === "thunderforest_transport" || sourceName === "thunderforest_outdoors") { authSourceName = "thunderforest" } else if (("url" in source) && source.url?.match(/\.stadiamaps\.com/)) { - // A few weird things here worth commenting on... - // - // 1. The code currently assumes openmaptiles == MapTiler, - // so we need to check the source URL. - // 2. Stadia Maps does not always require an API key, - // so there is no placeholder in our styles. - // We append it at the end during exporting if necessary. + // The code currently usually assumes openmaptiles == MapTiler, + // so we need to check the source URL. authSourceName = "stadia" - setAccessToken = (url: string) => `${url}?api_key=${accessToken}` } const accessToken = getAccessToken(authSourceName, mapStyle, opts) @@ -94,11 +87,21 @@ function replaceSourceAccessToken(mapStyle: StyleSpecification, sourceName: stri return mapStyle; } + let sourceUrl: string + if (authSourceName == "stadia") { + // Stadia Maps does not always require an API key, + // so there is no placeholder in our styles. + // We append it at the end of the URL when exporting if necessary. + sourceUrl = `${source.url}?api_key=${accessToken}` + } else { + sourceUrl = source.url.replace('{key}', accessToken) + } + const changedSources = { ...mapStyle.sources, [sourceName]: { ...source, - url: setAccessToken(source.url) + url: sourceUrl } } const changedStyle = { From d3b781b8e7ce03a2eaea6c84f137f4d0913673cf Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Thu, 29 Aug 2024 01:34:45 +0900 Subject: [PATCH 06/17] [WIP] Failed attempt at linking out to docs in help text --- src/components/Doc.tsx | 12 +++++++++--- src/components/ModalExport.tsx | 7 ------- src/libs/field-spec-additional.ts | 11 +++++++---- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/components/Doc.tsx b/src/components/Doc.tsx index c0fa40fe..6a5949b9 100644 --- a/src/components/Doc.tsx +++ b/src/components/Doc.tsx @@ -18,14 +18,15 @@ type DocProps = { 'sdk-support'?: { [key: string]: typeof headers } + docUrl?: string } -}; +}; // & WithTranslation? export default class Doc extends React.Component { render () { const {fieldSpec} = this.props; - const {doc, values} = fieldSpec; + const {doc, values, docUrl} = fieldSpec; const sdkSupport = fieldSpec['sdk-support']; const renderValues = ( @@ -85,7 +86,12 @@ export default class Doc extends React.Component {
} + {docUrl && +
+ console.log('Link clicked')}>Learn More (TODO i18n) +
+ } ); } -} \ No newline at end of file +} diff --git a/src/components/ModalExport.tsx b/src/components/ModalExport.tsx index f3c85783..1fa6b32b 100644 --- a/src/components/ModalExport.tsx +++ b/src/components/ModalExport.tsx @@ -116,13 +116,6 @@ class ModalExportInternal extends React.Component {

{t("Download a JSON style to your computer.")}

-

- MapTiler,  - ThunderForest, - and Stadia Maps  - may require access keys or other authentication to access map tiles. - Refer to their documentation for details. -

({ maputnik: { maptiler_access_token: { label: t("MapTiler Access Token"), - doc: t("Public access token for MapTiler Cloud.") + doc: t("Public access token for MapTiler Cloud."), + docUrl: "https://docs.maptiler.com/cloud/api/authentication-key/" }, thunderforest_access_token: { label: t("Thunderforest Access Token"), - doc: t("Public access token for Thunderforest services.") + doc: t("Public access token for Thunderforest services."), + docUrl: "https://www.thunderforest.com/docs/apikeys/", }, stadia_access_token: { label: t("Stadia Maps API Key"), - doc: t("API key for Stadia Maps.") + doc: t("API key for Stadia Maps."), + docUrl: "https://docs.stadiamaps.com/authentication/", }, style_renderer: { label: t("Style Renderer"), - doc: t("Choose the default Maputnik renderer for this style."), + doc: t("Choose the default Maputnik renderer for this style.") }, } }) From bf4686b3d47c9688e08b14eccfe9b20498f0504c Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Fri, 20 Sep 2024 18:53:03 +0900 Subject: [PATCH 07/17] Fix usability of hyperlinks --- src/components/Block.tsx | 4 +++- src/components/Doc.tsx | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/Block.tsx b/src/components/Block.tsx index 1f37d9ce..63d6635f 100644 --- a/src/components/Block.tsx +++ b/src/components/Block.tsx @@ -56,7 +56,9 @@ export default class Block extends React.Component { if (event.nativeEvent.target.nodeName !== "INPUT" && !contains) { event.stopPropagation(); } - event.preventDefault(); + if (event.nativeEvent.target.nodeName !== "A") { + event.preventDefault(); + } } render() { diff --git a/src/components/Doc.tsx b/src/components/Doc.tsx index 6a5949b9..d54a23d2 100644 --- a/src/components/Doc.tsx +++ b/src/components/Doc.tsx @@ -18,7 +18,8 @@ type DocProps = { 'sdk-support'?: { [key: string]: typeof headers } - docUrl?: string + docUrl?: string, + docUrlDescription?: string } }; // & WithTranslation? @@ -26,7 +27,7 @@ export default class Doc extends React.Component { render () { const {fieldSpec} = this.props; - const {doc, values, docUrl} = fieldSpec; + const {doc, values, docUrl, docUrlDescription} = fieldSpec; const sdkSupport = fieldSpec['sdk-support']; const renderValues = ( @@ -86,9 +87,9 @@ export default class Doc extends React.Component {
} - {docUrl && + {docUrl && docUrlDescription &&
- console.log('Link clicked')}>Learn More (TODO i18n) + console.log('Link clicked')}>{docUrlDescription}
} From 20d82dc8b2d1ba62cf3841c92f9d00775ad8cb16 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Fri, 20 Sep 2024 18:54:05 +0900 Subject: [PATCH 08/17] Run i18n refresh --- src/libs/field-spec-additional.ts | 5 ++++- src/locales/de/translation.json | 3 +++ src/locales/fr/translation.json | 7 +++++-- src/locales/he/translation.json | 10 ++++++---- src/locales/ja/translation.json | 8 +++++--- src/locales/zh/translation.json | 6 ++++-- 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/libs/field-spec-additional.ts b/src/libs/field-spec-additional.ts index 3f1108e1..25ce7bbd 100644 --- a/src/libs/field-spec-additional.ts +++ b/src/libs/field-spec-additional.ts @@ -5,17 +5,20 @@ const spec = (t: TFunction) => ({ maptiler_access_token: { label: t("MapTiler Access Token"), doc: t("Public access token for MapTiler Cloud."), - docUrl: "https://docs.maptiler.com/cloud/api/authentication-key/" + docUrl: "https://docs.maptiler.com/cloud/api/authentication-key/", + docUrlDescription: t("Learn More") }, thunderforest_access_token: { label: t("Thunderforest Access Token"), doc: t("Public access token for Thunderforest services."), docUrl: "https://www.thunderforest.com/docs/apikeys/", + docUrlDescription: t("Learn More") }, stadia_access_token: { label: t("Stadia Maps API Key"), doc: t("API key for Stadia Maps."), docUrl: "https://docs.stadiamaps.com/authentication/", + docUrlDescription: t("Learn More") }, style_renderer: { label: t("Style Renderer"), diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json index f7f88f22..99a56972 100644 --- a/src/locales/de/translation.json +++ b/src/locales/de/translation.json @@ -176,8 +176,11 @@ "Error:": "Fehler:", "MapTiler Access Token": "MapTiler Zugriffstoken", "Public access token for MapTiler Cloud.": "Öffentlicher Zugriffstoken für MapTiler Cloud.", + "Learn More": "__STRING_NOT_TRANSLATED__", "Thunderforest Access Token": "Thunderforest Zugriffstoken", "Public access token for Thunderforest services.": "Öffentlicher Zugriffstoken für Thunderforest-Dienste.", + "Stadia Maps API Key": "__STRING_NOT_TRANSLATED__", + "API key for Stadia Maps.": "__STRING_NOT_TRANSLATED__", "Style Renderer": "Stil-Renderer", "Choose the default Maputnik renderer for this style.": "Wähle den Standard-Renderer für diesen Stil aus.", "Language": "Sprache", diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 6852a3e0..2261a960 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -34,7 +34,6 @@ "Style Settings": "Paramètres du style", "View": "Vue", "Color accessibility": "Accessibilité des couleurs", - "Language": "Langue", "Help": "Aide", "Comments for the current layer. This is non-standard and not in the spec.": "Commentaires pour le calque actuel. Ceci n'est pas standard et n'est pas dans la spécification.", "Comments": "Commentaires", @@ -73,8 +72,8 @@ "Collapse": "Réduire", "Expand": "Développer", "Add Layer": "Ajouter un calque", - "Zoom:": "Zoom :", "Search": "Recherche", + "Zoom:": "Zoom :", "Close popup": "Fermer la fenêtre", "cursor:": "curseur :", "center:": "centre :", @@ -177,10 +176,14 @@ "Error:": "Erreur :", "MapTiler Access Token": "Jeton d'accès MapTiler", "Public access token for MapTiler Cloud.": "Jeton d'accès public pour MapTiler Cloud.", + "Learn More": "__STRING_NOT_TRANSLATED__", "Thunderforest Access Token": "Jeton d'accès Thunderforest", "Public access token for Thunderforest services.": "Jeton d'accès public pour les services Thunderforest.", + "Stadia Maps API Key": "__STRING_NOT_TRANSLATED__", + "API key for Stadia Maps.": "__STRING_NOT_TRANSLATED__", "Style Renderer": "Moteur de rendu pour le style", "Choose the default Maputnik renderer for this style.": "Choisissez le moteur de rendu Maputnik par défaut pour ce style.", + "Language": "Langue", "Layer options": "Options du calque", "Paint properties": "Propriétés de peinture", "Layout properties": "Propriétés de mise en page", diff --git a/src/locales/he/translation.json b/src/locales/he/translation.json index 3ac5fb5f..5a58fa84 100644 --- a/src/locales/he/translation.json +++ b/src/locales/he/translation.json @@ -34,7 +34,6 @@ "Style Settings": "הגדרות הסטייל", "View": "תצוגה", "Color accessibility": "נגישות צבעים", - "Language": "שפה", "Help": "עזרה", "Comments for the current layer. This is non-standard and not in the spec.": "הערות על השכבה הנוכחית. זה לא חלק מהספסיפיקציות", "Comments": "הערות", @@ -73,8 +72,8 @@ "Collapse": "הקטנה", "Expand": "הגדלה", "Add Layer": "הוספת שכבה", - "Zoom:": "זום:", "Search": "חיפוש", + "Zoom:": "זום:", "Close popup": "סגירת החלון", "cursor:": "סמן", "center:": "מרכז:", @@ -82,7 +81,7 @@ "Close modal": "סגירת חלונית", "Debug": "דיבאג", "Options": "אפשרויות", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "<0>פתיחה ב-OSM - פתיחה של התצוגה הנוכחית ב- openstreetmap.org", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "__STRING_NOT_TRANSLATED__", "Export Style": "ייצוא של הסטייל", "Download Style": "הורדה של הסטייל", "Download a JSON style to your computer.": "הורדה של הסטייל למחשב", @@ -177,10 +176,13 @@ "Error:": "שגיאה", "MapTiler Access Token": "MapTiler Access Token", "Public access token for MapTiler Cloud.": "Public access token for MapTiler Cloud.", + "Learn More": "__STRING_NOT_TRANSLATED__", "Thunderforest Access Token": "Thunderforest Access Token", "Public access token for Thunderforest services.": "Public access token for Thunderforest services.", "Stadia Maps API Key": "Stadia Maps API Key", "API key for Stadia Maps.": "API key for Stadia Maps", "Style Renderer": "צייר הסטייל", - "Choose the default Maputnik renderer for this style.": "בחירת צייר ברירת המחדל של מפוטניק עבור הסטייל הזה" + "Choose the default Maputnik renderer for this style.": "בחירת צייר ברירת המחדל של מפוטניק עבור הסטייל הזה", + "Language": "שפה", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "<0>פתיחה ב-OSM - פתיחה של התצוגה הנוכחית ב- openstreetmap.org" } diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json index 6f9f1b50..ce7bdb59 100644 --- a/src/locales/ja/translation.json +++ b/src/locales/ja/translation.json @@ -34,7 +34,6 @@ "Style Settings": "スタイル設定", "View": "表示", "Color accessibility": "色のアクセシビリティ", - "Language": "言語", "Help": "ヘルプ", "Comments for the current layer. This is non-standard and not in the spec.": "現在のレイヤーのコメント。注意:この機能は標準ではないため、他のライブラリとの互換性状況はわかりません。", "Comments": "コメント", @@ -73,8 +72,8 @@ "Collapse": "畳む", "Expand": "展開", "Add Layer": "レイヤー追加", - "Zoom:": "ズーム:", "Search": "検索", + "Zoom:": "ズーム:", "Close popup": "ポップアップを閉じる", "cursor:": "カーソル", "center:": "中央:", @@ -82,7 +81,7 @@ "Close modal": "モーダルを閉じる", "Debug": "デバッグ", "Options": "設定", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "現在のビューを <0>openstreetmap.org で開く", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "__STRING_NOT_TRANSLATED__", "Export Style": "スタイルをエクスポート", "Download Style": "スタイルをダウンロード", "Download a JSON style to your computer.": "パソコンにJSONスタイルをダウンロードします。", @@ -177,12 +176,15 @@ "Error:": "エラー:", "MapTiler Access Token": "MapTiler アクセストークン", "Public access token for MapTiler Cloud.": "MapTiler Cloud の公開用アクセストークン", + "Learn More": "__STRING_NOT_TRANSLATED__", "Thunderforest Access Token": "Thunderforest アクセストークン", "Public access token for Thunderforest services.": "Thunderforest サービスの公開用アクセストークン", "Stadia Maps API Key": "Stadia Maps API キー", "API key for Stadia Maps.": "Stadia Maps の API キー", "Style Renderer": "スタイルレンダラ", "Choose the default Maputnik renderer for this style.": "このスタイルのデフォルトの Maputnik レンダラを選択してください", + "Language": "言語", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "現在のビューを <0>openstreetmap.org で開く", "Layer options": "レイヤー設定", "Paint properties": "ペイントプロパティ", "Layout properties": "レイアウトプロパティ", diff --git a/src/locales/zh/translation.json b/src/locales/zh/translation.json index aaf9e225..e2fee490 100644 --- a/src/locales/zh/translation.json +++ b/src/locales/zh/translation.json @@ -34,7 +34,6 @@ "Style Settings": "样式设置", "View": "视图", "Color accessibility": "颜色可访问性", - "Language": "语言", "Help": "帮助", "Comments for the current layer. This is non-standard and not in the spec.": "当前图层的注释。注意:这不是标准功能,可能与其他库不兼容。", "Comments": "注释", @@ -73,8 +72,8 @@ "Collapse": "折叠", "Expand": "展开", "Add Layer": "添加图层", - "Zoom:": "缩放:", "Search": "搜索", + "Zoom:": "缩放:", "Close popup": "关闭弹出窗口", "cursor:": "光标:", "center:": "中心:", @@ -82,6 +81,7 @@ "Close modal": "关闭模态框", "Debug": "调试", "Options": "选项", + "<0>Open in OSM — Opens the current view on openstreetmap.org": "__STRING_NOT_TRANSLATED__", "Export Style": "导出样式", "Download Style": "下载样式", "Download a JSON style to your computer.": "将JSON样式下载到您的电脑。", @@ -176,12 +176,14 @@ "Error:": "错误:", "MapTiler Access Token": "MapTiler 访问令牌", "Public access token for MapTiler Cloud.": "MapTiler Cloud 的公共访问令牌。", + "Learn More": "__STRING_NOT_TRANSLATED__", "Thunderforest Access Token": "Thunderforest 访问令牌", "Public access token for Thunderforest services.": "Thunderforest 服务的公共访问令牌。", "Stadia Maps API Key": "Stadia Maps API 密钥", "API key for Stadia Maps.": "Stadia Maps 的 API 密钥", "Style Renderer": "样式渲染器", "Choose the default Maputnik renderer for this style.": "为这种样式选择默认的Maputnik渲染器。", + "Language": "语言", "<0>Open in OSM — Opens the current view on openstreetmap.org": "在 openstreetmap.org 打开当前视图", "Layer options": "图层选项", "Paint properties": "绘制属性", From eb9e7e018430ca2fb679b97121068c5db005cefa Mon Sep 17 00:00:00 2001 From: Harel M Date: Fri, 20 Sep 2024 13:50:02 +0300 Subject: [PATCH 09/17] Update src/locales/he/translation.json --- src/locales/he/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/he/translation.json b/src/locales/he/translation.json index 5a58fa84..5776573c 100644 --- a/src/locales/he/translation.json +++ b/src/locales/he/translation.json @@ -176,7 +176,7 @@ "Error:": "שגיאה", "MapTiler Access Token": "MapTiler Access Token", "Public access token for MapTiler Cloud.": "Public access token for MapTiler Cloud.", - "Learn More": "__STRING_NOT_TRANSLATED__", + "Learn More": "מידע נוסף", "Thunderforest Access Token": "Thunderforest Access Token", "Public access token for Thunderforest services.": "Public access token for Thunderforest services.", "Stadia Maps API Key": "Stadia Maps API Key", From cb4635a52ef1e0fecbaa10979b1a2c84560dff9d Mon Sep 17 00:00:00 2001 From: Harel M Date: Fri, 20 Sep 2024 13:52:07 +0300 Subject: [PATCH 10/17] Update src/locales/de/translation.json Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com> --- src/locales/de/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json index 99a56972..332c792d 100644 --- a/src/locales/de/translation.json +++ b/src/locales/de/translation.json @@ -176,7 +176,7 @@ "Error:": "Fehler:", "MapTiler Access Token": "MapTiler Zugriffstoken", "Public access token for MapTiler Cloud.": "Öffentlicher Zugriffstoken für MapTiler Cloud.", - "Learn More": "__STRING_NOT_TRANSLATED__", + "Learn More": "Mehr erfahren", "Thunderforest Access Token": "Thunderforest Zugriffstoken", "Public access token for Thunderforest services.": "Öffentlicher Zugriffstoken für Thunderforest-Dienste.", "Stadia Maps API Key": "__STRING_NOT_TRANSLATED__", From b821b4f0fbee2dda3dd3d14c612c4e4c64f14250 Mon Sep 17 00:00:00 2001 From: Harel M Date: Fri, 20 Sep 2024 13:52:18 +0300 Subject: [PATCH 11/17] Update src/locales/de/translation.json Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com> --- src/locales/de/translation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json index 332c792d..6586b2e3 100644 --- a/src/locales/de/translation.json +++ b/src/locales/de/translation.json @@ -179,8 +179,8 @@ "Learn More": "Mehr erfahren", "Thunderforest Access Token": "Thunderforest Zugriffstoken", "Public access token for Thunderforest services.": "Öffentlicher Zugriffstoken für Thunderforest-Dienste.", - "Stadia Maps API Key": "__STRING_NOT_TRANSLATED__", - "API key for Stadia Maps.": "__STRING_NOT_TRANSLATED__", + "Stadia Maps API Key": "Stadia Maps API-Schlüssel", + "API key for Stadia Maps.": "API-Schlüssel für Stadia Maps.", "Style Renderer": "Stil-Renderer", "Choose the default Maputnik renderer for this style.": "Wähle den Standard-Renderer für diesen Stil aus.", "Language": "Sprache", From 3f6c99e74f79f58f4a2692b74d0e4640158577a9 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Sat, 21 Sep 2024 00:38:02 +0900 Subject: [PATCH 12/17] Update src/locales/fr/translation.json Co-authored-by: Hugues Tavernier --- src/locales/fr/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 2261a960..9806914d 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -176,7 +176,7 @@ "Error:": "Erreur :", "MapTiler Access Token": "Jeton d'accès MapTiler", "Public access token for MapTiler Cloud.": "Jeton d'accès public pour MapTiler Cloud.", - "Learn More": "__STRING_NOT_TRANSLATED__", + "Learn More": "En savoir plus", "Thunderforest Access Token": "Jeton d'accès Thunderforest", "Public access token for Thunderforest services.": "Jeton d'accès public pour les services Thunderforest.", "Stadia Maps API Key": "__STRING_NOT_TRANSLATED__", From 34b35f98a6be14495cbb4cd1ffb0debf81e34ae2 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Sat, 21 Sep 2024 00:39:01 +0900 Subject: [PATCH 13/17] Apply suggestions from code review Co-authored-by: Hugues Tavernier --- src/locales/fr/translation.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json index 9806914d..73b23855 100644 --- a/src/locales/fr/translation.json +++ b/src/locales/fr/translation.json @@ -179,8 +179,8 @@ "Learn More": "En savoir plus", "Thunderforest Access Token": "Jeton d'accès Thunderforest", "Public access token for Thunderforest services.": "Jeton d'accès public pour les services Thunderforest.", - "Stadia Maps API Key": "__STRING_NOT_TRANSLATED__", - "API key for Stadia Maps.": "__STRING_NOT_TRANSLATED__", + "Stadia Maps API Key": "Clé d'API Stadia Maps", + "API key for Stadia Maps.": "Clé d'API pour Stadia Maps.", "Style Renderer": "Moteur de rendu pour le style", "Choose the default Maputnik renderer for this style.": "Choisissez le moteur de rendu Maputnik par défaut pour ce style.", "Language": "Langue", From 9287d6f60b13c24c6a5f2206bc4123f0a67a1aa3 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Sat, 21 Sep 2024 00:36:47 +0900 Subject: [PATCH 14/17] Remove console log --- src/components/Doc.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Doc.tsx b/src/components/Doc.tsx index d54a23d2..b8915be0 100644 --- a/src/components/Doc.tsx +++ b/src/components/Doc.tsx @@ -89,7 +89,7 @@ export default class Doc extends React.Component { } {docUrl && docUrlDescription && } From a8ebd771c47a0b5fe545c05746626bb1afa620a8 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Sat, 21 Sep 2024 04:51:22 +0900 Subject: [PATCH 15/17] More code review fixes --- src/components/Doc.tsx | 2 +- src/locales/he/translation.json | 1 - src/locales/ja/translation.json | 1 - src/locales/zh/translation.json | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Doc.tsx b/src/components/Doc.tsx index b8915be0..7d48ee16 100644 --- a/src/components/Doc.tsx +++ b/src/components/Doc.tsx @@ -21,7 +21,7 @@ type DocProps = { docUrl?: string, docUrlDescription?: string } -}; // & WithTranslation? +}; export default class Doc extends React.Component { render () { diff --git a/src/locales/he/translation.json b/src/locales/he/translation.json index 5776573c..da613a80 100644 --- a/src/locales/he/translation.json +++ b/src/locales/he/translation.json @@ -81,7 +81,6 @@ "Close modal": "סגירת חלונית", "Debug": "דיבאג", "Options": "אפשרויות", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "__STRING_NOT_TRANSLATED__", "Export Style": "ייצוא של הסטייל", "Download Style": "הורדה של הסטייל", "Download a JSON style to your computer.": "הורדה של הסטייל למחשב", diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json index ce7bdb59..9ddfbb44 100644 --- a/src/locales/ja/translation.json +++ b/src/locales/ja/translation.json @@ -81,7 +81,6 @@ "Close modal": "モーダルを閉じる", "Debug": "デバッグ", "Options": "設定", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "__STRING_NOT_TRANSLATED__", "Export Style": "スタイルをエクスポート", "Download Style": "スタイルをダウンロード", "Download a JSON style to your computer.": "パソコンにJSONスタイルをダウンロードします。", diff --git a/src/locales/zh/translation.json b/src/locales/zh/translation.json index e2fee490..27fade40 100644 --- a/src/locales/zh/translation.json +++ b/src/locales/zh/translation.json @@ -81,7 +81,6 @@ "Close modal": "关闭模态框", "Debug": "调试", "Options": "选项", - "<0>Open in OSM — Opens the current view on openstreetmap.org": "__STRING_NOT_TRANSLATED__", "Export Style": "导出样式", "Download Style": "下载样式", "Download a JSON style to your computer.": "将JSON样式下载到您的电脑。", From 4063daf9172f0986a0f7c72bf495e31db7394e4f Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Sat, 21 Sep 2024 14:55:42 +0900 Subject: [PATCH 16/17] Refactor after discussion --- src/components/Doc.tsx | 8 ++++---- src/libs/field-spec-additional.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Doc.tsx b/src/components/Doc.tsx index 7d48ee16..8996a37e 100644 --- a/src/components/Doc.tsx +++ b/src/components/Doc.tsx @@ -19,7 +19,7 @@ type DocProps = { [key: string]: typeof headers } docUrl?: string, - docUrlDescription?: string + docUrlLinkText?: string } }; @@ -27,7 +27,7 @@ export default class Doc extends React.Component { render () { const {fieldSpec} = this.props; - const {doc, values, docUrl, docUrlDescription} = fieldSpec; + const {doc, values, docUrl, docUrlLinkText} = fieldSpec; const sdkSupport = fieldSpec['sdk-support']; const renderValues = ( @@ -87,9 +87,9 @@ export default class Doc extends React.Component { } - {docUrl && docUrlDescription && + {docUrl && docUrlLinkText && } diff --git a/src/libs/field-spec-additional.ts b/src/libs/field-spec-additional.ts index 25ce7bbd..57efa3f7 100644 --- a/src/libs/field-spec-additional.ts +++ b/src/libs/field-spec-additional.ts @@ -6,19 +6,19 @@ const spec = (t: TFunction) => ({ label: t("MapTiler Access Token"), doc: t("Public access token for MapTiler Cloud."), docUrl: "https://docs.maptiler.com/cloud/api/authentication-key/", - docUrlDescription: t("Learn More") + docUrlLinkText: t("Learn More") }, thunderforest_access_token: { label: t("Thunderforest Access Token"), doc: t("Public access token for Thunderforest services."), docUrl: "https://www.thunderforest.com/docs/apikeys/", - docUrlDescription: t("Learn More") + docUrlLinkText: t("Learn More") }, stadia_access_token: { label: t("Stadia Maps API Key"), doc: t("API key for Stadia Maps."), docUrl: "https://docs.stadiamaps.com/authentication/", - docUrlDescription: t("Learn More") + docUrlLinkText: t("Learn More") }, style_renderer: { label: t("Style Renderer"), From c316af873a436476b7035d9a480262f7d8ff3a43 Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Wed, 25 Sep 2024 11:29:06 +0900 Subject: [PATCH 17/17] Update src/locales/ja/translation.json Co-authored-by: Keitaroh Kobayashi --- src/locales/ja/translation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json index 9ddfbb44..6e855ae9 100644 --- a/src/locales/ja/translation.json +++ b/src/locales/ja/translation.json @@ -175,7 +175,7 @@ "Error:": "エラー:", "MapTiler Access Token": "MapTiler アクセストークン", "Public access token for MapTiler Cloud.": "MapTiler Cloud の公開用アクセストークン", - "Learn More": "__STRING_NOT_TRANSLATED__", + "Learn More": "詳細はこちら", "Thunderforest Access Token": "Thunderforest アクセストークン", "Public access token for Thunderforest services.": "Thunderforest サービスの公開用アクセストークン", "Stadia Maps API Key": "Stadia Maps API キー",