Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mappings: fix issue with explicitLanguageTags set to true and label i… #1012

Merged
merged 1 commit into from
Jun 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions model/ConceptMappingPropertyValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = [
Expand All @@ -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.
Expand Down