Skip to content

Commit

Permalink
Merge pull request #42 from bozana/9707
Browse files Browse the repository at this point in the history
pkp/pkp-lib#9707 renamte locale
  • Loading branch information
bozana authored Dec 11, 2024
2 parents 465f881 + 3f88dfa commit be50e3c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions filter/PreprintCrossrefXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use APP\plugins\generic\crossref\CrossrefExportDeployment;
use APP\publication\Publication;
use DOMDocument;
use PKP\i18n\LocaleConversion;
use PKP\submission\PKPSubmission;

class PreprintCrossrefXmlFilter extends \PKP\plugins\importexport\native\filter\NativeExportFilter
Expand Down Expand Up @@ -155,7 +154,7 @@ public function createPostedContentNode($doc, $publication, $submission)

$postedContentNode = $doc->createElementNS($deployment->getNamespace(), 'posted_content');
$postedContentNode->setAttribute('type', 'preprint');
$postedContentNode->setAttribute('language', LocaleConversion::getIso1FromLocale($locale));
$postedContentNode->setAttribute('language', \Locale::getPrimaryLanguage($locale));

// contributors
$authors = $publication->getData('authors');
Expand All @@ -177,7 +176,7 @@ public function createPostedContentNode($doc, $publication, $submission)

// Check if both givenName and familyName is set for the submission language.
if (!empty($familyNames[$locale]) && !empty($givenNames[$locale])) {
$personNameNode->setAttribute('language', LocaleConversion::getIso1FromLocale($locale));
$personNameNode->setAttribute('language', \Locale::getPrimaryLanguage($locale));
$personNameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'given_name', htmlspecialchars(ucfirst($givenNames[$locale]), ENT_COMPAT, 'UTF-8')));
$personNameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'surname', htmlspecialchars(ucfirst($familyNames[$locale]), ENT_COMPAT, 'UTF-8')));

Expand All @@ -195,7 +194,7 @@ public function createPostedContentNode($doc, $publication, $submission)
}

$nameNode = $doc->createElementNS($deployment->getNamespace(), 'name');
$nameNode->setAttribute('language', LocaleConversion::getIso1FromLocale($otherLocal));
$nameNode->setAttribute('language', \Locale::getPrimaryLanguage($otherLocal));

$nameNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'surname', htmlspecialchars(ucfirst($familyName), ENT_COMPAT, 'UTF-8')));
if (isset($givenNames[$otherLocal]) && !empty($givenNames[$otherLocal])) {
Expand Down Expand Up @@ -236,7 +235,7 @@ public function createPostedContentNode($doc, $publication, $submission)
$abstracts = $publication->getData('abstract') ?: [];
foreach($abstracts as $lang => $abstract) {
$abstractNode = $doc->createElementNS($deployment->getJATSNamespace(), 'jats:abstract');
$abstractNode->setAttributeNS($deployment->getXMLNamespace(), 'xml:lang', LocaleConversion::getIso1FromLocale($lang));
$abstractNode->setAttributeNS($deployment->getXMLNamespace(), 'xml:lang', str_replace(['_', '@'], '-', $lang));
$abstractNode->appendChild($doc->createElementNS($deployment->getJATSNamespace(), 'jats:p', htmlspecialchars(html_entity_decode(strip_tags($abstract), ENT_COMPAT, 'UTF-8'), ENT_COMPAT, 'utf-8')));
$postedContentNode->appendChild($abstractNode);
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit be50e3c

Please sign in to comment.