From e0d473765bb5da079000b85500d508fe2432fc69 Mon Sep 17 00:00:00 2001 From: kouralex <1723419+kouralex@users.noreply.github.com> Date: Tue, 23 Jun 2020 11:07:38 +0300 Subject: [PATCH] mappings: fix issue with explicitLanguageTags set to true and label is just shortened property; fix property text help --- model/ConceptMappingPropertyValue.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/model/ConceptMappingPropertyValue.php b/model/ConceptMappingPropertyValue.php index 6f9597bb0..698e93a45 100644 --- a/model/ConceptMappingPropertyValue.php +++ b/model/ConceptMappingPropertyValue.php @@ -192,13 +192,19 @@ public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null) ] ], // EXTRA - 'description' => gettext($this->type . "_help"), // pop-up text 'hrefLink' => $hrefLink, // link to resource as displayed in the UI 'lang' => $propertyLang, // TBD: could it be part of the prefLabel? 'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI 'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch ]; + $helpprop = $this->type . "_help"; + // see if we have a translation for the property help text + $help = gettext($helpprop); + if ($help != $helpprop) { + $ret['description'] = $help; + } + $fromScheme = $this->vocab->getDefaultConceptScheme(); if (isset($fromScheme)) { $ret['fromScheme'] = [ @@ -221,10 +227,13 @@ public function asJskos($queryExVocabs = true, $lang = null, $hrefLink = null) $label = $this->getLabel($lang, $queryExVocabs); if (isset($label)) { if (is_string($label)) { - list($labelLang, $labelValue) = ['-', $label]; + list($labelLang, $labelValue) = ['', $label]; } else { list($labelLang, $labelValue) = [$label->getLang(), $label->getValue()]; } + // set the language of the preferred label to be whatever returned + $ret['lang'] = $labelLang; + if ($labelValue != $this->getUri()) { // The `queryLabel()` method above will fallback to returning the URI // if no label was found. We don't want that here.