Skip to content

Commit

Permalink
Merge pull request #60 from bozana/9707
Browse files Browse the repository at this point in the history
pkp/pkp-lib#9707 rename locales, adapt language distribution
  • Loading branch information
bozana authored Dec 11, 2024
2 parents f33d202 + 7699c0a commit 8be6365
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions OAIMetadataFormat_JATS.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
$publication = $article->getCurrentPublication();

$articleNode = $xpath->query('//article')->item(0);
$articleNode->setAttribute('xml:lang', substr($article->getData('locale'),0,2));
$articleNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $article->getData('locale')));
$articleNode->setAttribute('dtd-version', '1.1');
$articleNode->setAttribute('specific-use', 'eps-0.1');
$articleNode->setAttribute('xmlns', 'https://jats.nlm.nih.gov/publishing/1.1/');
Expand Down Expand Up @@ -247,7 +247,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
$titleNode = $this->_addChildInOrder($articleMetaNode, $doc->createElement('issue-title'));
$titleText = $doc->createTextNode($title);
$titleNode->appendChild($titleText);
$titleNode->setAttribute('xml:lang', substr($locale,0,2));
$titleNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $locale));
}
}

Expand All @@ -256,7 +256,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
$titleGroupNode = $xpath->query('//article/front/article-meta/title-group')->item(0);
while ($titleGroupNode->hasChildNodes()) $titleGroupNode->removeChild($titleGroupNode->firstChild);
$titleNode = $titleGroupNode->appendChild($doc->createElement('article-title'));
$titleNode->setAttribute('xml:lang', substr($article->getData('locale'),0,2));
$titleNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $article->getData('locale')));

$articleTitleHtml = $doc->createDocumentFragment();
$articleTitleHtml->appendXML(
Expand All @@ -275,7 +275,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
$subtitleHtml->appendXML($this->mapHtmlTagsForTitle($subtitle));

$subtitleNode = $titleGroupNode->appendChild($doc->createElement('subtitle'));
$subtitleNode->setAttribute('xml:lang', substr($article->getData('locale'),0,2));
$subtitleNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $article->getData('locale')));

$subtitleNode->appendChild($subtitleHtml);
}
Expand All @@ -289,7 +289,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
}

$transTitleGroupNode = $titleGroupNode->appendChild($doc->createElement('trans-title-group'));
$transTitleGroupNode->setAttribute('xml:lang', substr($locale,0,2));
$transTitleGroupNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $locale));
$titleNode = $transTitleGroupNode->appendChild($doc->createElement('trans-title'));

$titleHtml = $doc->createDocumentFragment();
Expand All @@ -314,7 +314,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
if (empty($keywords)) continue;

$kwdGroupNode = $this->_addChildInOrder($articleMetaNode, $doc->createElement('kwd-group'));
$kwdGroupNode->setAttribute('xml:lang', substr($locale,0,2));
$kwdGroupNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $locale));
$kwdGroupNode->appendChild($doc->createElement('title'))->appendChild($doc->createTextNode(__('article.subject', [], $locale)));
foreach ($keywords as $keyword) $kwdGroupNode->appendChild($doc->createElement('kwd'))->appendChild($doc->createTextNode($keyword));
}
Expand All @@ -336,7 +336,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
if (strpos($abstract, '<p>')===null) $abstract = "<p>$abstract</p>";
$abstractDoc->loadXML(($isPrimary?'<abstract>':'<trans-abstract>') . $purifier->purify($abstract) . ($isPrimary?'</abstract>':'</trans-abstract>'));
$abstractNode = $this->_addChildInOrder($articleMetaNode, $doc->importNode($abstractDoc->documentElement, true));
if (!$isPrimary) $abstractNode->setAttribute('xml:lang', substr($locale,0,2));
if (!$isPrimary) $abstractNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $locale));
}

// Set the journal-id[publisher-id']
Expand Down Expand Up @@ -401,7 +401,7 @@ protected function _mungeMetadata($doc, $journal, $article, $section, $issue) {
if (empty($title)) continue;
$subjGroupNode = $articleCategoriesNode->appendChild($doc->createElement('subj-group'));
$subjGroupNode->setAttribute('subj-group-type', 'heading');
$subjGroupNode->setAttribute('xml:lang', substr($locale,0,2));
$subjGroupNode->setAttribute('xml:lang', str_replace(['_', '@'], '-', $locale));
$subjectNode = $subjGroupNode->appendChild($doc->createElement('subject'));
$subjectNode->appendChild($doc->createTextNode($title));
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 8be6365

Please sign in to comment.