From 04f77be5bcd9c10331b580643613bdbdd943198f Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Mon, 7 Feb 2022 10:42:36 +0100 Subject: [PATCH] fix KeepRight warnings showing up as "Unknown" issues (close #8925) --- CHANGELOG.md | 2 ++ modules/ui/keepRight_details.js | 10 +++++----- modules/ui/keepRight_header.js | 10 +++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3873d8446..103cd46e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ _Breaking developer changes, which may affect downstream projects or sites that * Handle indoor features like buildings when checking for crossing ways ([#8944]) #### :bug: Bugfixes * Fix rendering of KeepRight issues ([#8963]) +* Fix KeepRight warnings showing up as "Unknown" issues ([#8925]) #### :rocket: Presets * Optimize order of values in dropdowns of `access` fields ([#8945]) * Use value of `vehicle` tag as placeholder value of `access` fields for `motor_vehicle` and `bicycle` @@ -56,6 +57,7 @@ _Breaking developer changes, which may affect downstream projects or sites that [#8774]: https://github.com/openstreetmap/iD/pull/8774 [#8811]: https://github.com/openstreetmap/iD/issues/8811 +[#8925]: https://github.com/openstreetmap/iD/issues/8925 [#8927]: https://github.com/openstreetmap/iD/issues/8927 [#8944]: https://github.com/openstreetmap/iD/issues/8944 [#8945]: https://github.com/openstreetmap/iD/issues/8945 diff --git a/modules/ui/keepRight_details.js b/modules/ui/keepRight_details.js index 6045ff664..a5efc146f 100644 --- a/modules/ui/keepRight_details.js +++ b/modules/ui/keepRight_details.js @@ -4,7 +4,7 @@ import { import { presetManager } from '../presets'; import { modeSelect } from '../modes/select'; -import { t } from '../core/localizer'; +import { t, localizer } from '../core/localizer'; import { utilDisplayName, utilHighlightEntities, utilEntityRoot } from '../util'; @@ -18,11 +18,11 @@ export function uiKeepRightDetails(context) { let replacements = d.replacements || {}; replacements.default = unknown; // special key `default` works as a fallback string - let detail = t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements); - if (detail === unknown.html) { - detail = t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements); + if (localizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) { + return t.html(`QA.keepRight.errorTypes.${itemType}.description`, replacements); + } else { + return t.html(`QA.keepRight.errorTypes.${parentIssueType}.description`, replacements); } - return detail; } diff --git a/modules/ui/keepRight_header.js b/modules/ui/keepRight_header.js index 3931b61b7..12c076468 100644 --- a/modules/ui/keepRight_header.js +++ b/modules/ui/keepRight_header.js @@ -1,5 +1,5 @@ import { svgIcon } from '../svg/icon'; -import { t } from '../core/localizer'; +import { t, localizer } from '../core/localizer'; export function uiKeepRightHeader() { @@ -12,11 +12,11 @@ export function uiKeepRightHeader() { let replacements = d.replacements || {}; replacements.default = { html: unknown }; // special key `default` works as a fallback string - let title = t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements); - if (title === unknown) { - title = t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements); + if (localizer.hasTextForStringId(`QA.keepRight.errorTypes.${itemType}.title`)) { + return t.html(`QA.keepRight.errorTypes.${itemType}.title`, replacements); + } else { + return t.html(`QA.keepRight.errorTypes.${parentIssueType}.title`, replacements); } - return title; }