diff --git a/src/controls/externalurl/externalurlSeveralButtons.js b/src/controls/externalurl/externalurlSeveralButtons.js index 31c3f466c..a990a89b1 100644 --- a/src/controls/externalurl/externalurlSeveralButtons.js +++ b/src/controls/externalurl/externalurlSeveralButtons.js @@ -3,7 +3,13 @@ import { Component, Element as El, Button, dom } from '../../ui'; import replacer from '../../utils/replacer'; const externalurlSeveralButtons = function externalurlSeveralButtons(options = {}) { - const mainbuttonTooltipText = options.tooltipText || 'Visa kartan i en extern karttjänst'; + const localization = options.localization; + + function localize(key) { + return localization.getStringByKeys({ targetParentKey: 'externalurl', targetKey: key }); + } + + const mainbuttonTooltipText = options.tooltipText || localize('tooltipText'); const links = options.links; const hasValidMethod = links.some(link => link.method !== 'none'); let map; @@ -79,7 +85,7 @@ const externalurlSeveralButtons = function externalurlSeveralButtons(options = { }); buttons.push(externalUrlMainButton); links.forEach((link) => { - const tooltipText = link.tooltipText; + const tooltipText = link.tooltipText ? link.tooltipText : localize('linkTooltipText'); const buttonImage = link.buttonImage || '#fa-external-link'; const subButton = Button({ cls: `o-measure-length padding-small ${subButtoncls} icon-smaller round light box-shadow hidden`, diff --git a/src/controls/externalurl/externalurlSingleButton.js b/src/controls/externalurl/externalurlSingleButton.js index 2d41e7c59..a8a910cb7 100644 --- a/src/controls/externalurl/externalurlSingleButton.js +++ b/src/controls/externalurl/externalurlSingleButton.js @@ -3,13 +3,19 @@ import { Component, Element as El, Button, dom } from '../../ui'; import replacer from '../../utils/replacer'; const ExternalurlSingleButton = function ExternalurlSingleButton(options = {}) { + const localization = options.localization; + + function localize(key) { + return localization.getStringByKeys({ targetParentKey: 'externalurl', targetKey: key }); + } + let map; let viewer; let exUrlElement; let exUrlBtn; let target; const buttons = []; - const tooltip = options.links[0].tooltipText || options.tooltipText || 'Visa kartan i en extern karttjänst'; + const tooltip = options.links[0].tooltipText || options.tooltipText || localize('tooltipText'); const buttonImage = options.links[0].buttonImage || '#ic_baseline_link_24px'; const url = options.links[0].url; const method = options.links[0].method; @@ -17,7 +23,7 @@ const ExternalurlSingleButton = function ExternalurlSingleButton(options = {}) { function onClick() { if (!url) { - alert('No URL is specified in the configurations'); + alert(localize('noUrl')); return; } diff --git a/src/loc/en_US.json b/src/loc/en_US.json index 79651d58a..101a8e61b 100644 --- a/src/loc/en_US.json +++ b/src/loc/en_US.json @@ -105,6 +105,16 @@ "drawSquare": "Square", "drawCircle": "Circle", "drawFreehand": "Freehand" + }, + "bookmarks": { + "title": "Bookmarks", + "close": "Close", + "bookmarkLabel": "Bookmark for" + }, + "externalurl": { + "tooltipText": "Display the map in an external map service", + "noUrl": "No URL is specified in the configuration", + "linkTooltipText": "Open link" } }, "style": { @@ -146,10 +156,5 @@ "pointTypeSquare": "Square", "pointTypeMarker": "Marker" } - }, - "bookmarks": { - "title": "Bookmarks", - "close": "Close", - "bookmarkLabel": "Bookmark for" } -} \ No newline at end of file +} diff --git a/src/loc/sv_SE.json b/src/loc/sv_SE.json index 9ca16cd03..4bd4c37b9 100644 --- a/src/loc/sv_SE.json +++ b/src/loc/sv_SE.json @@ -105,8 +105,17 @@ "drawSquare": "Fyrkant", "drawCircle": "Cirkel", "drawFreehand": "Frihand" + }, + "bookmarks": { + "title": "Bokmärken", + "close": "Stäng", + "bookmarkLabel": "Bokmärke för" + }, + "externalurl": { + "tooltipText": "Visa kartan i en extern karttjänst", + "noUrl": "Ingen URL är angiven i konfigurationen", + "linkTooltipText": "Öppna länk" } - }, "style": { "drawStyles": { @@ -147,10 +156,5 @@ "pointTypeSquare": "Fyrkant", "pointTypeMarker": "Markör" } - }, - "bookmarks": { - "title": "Bokmärken", - "close": "Stäng", - "bookmarkLabel": "Bokmärke för" } -} \ No newline at end of file +}