Skip to content

Commit 3fce0fc

Browse files
authored
Merge pull request #577 from jyhein/f5000
Remove separate Dublin Core Language metadata field and only use Submission Locale to define the language
2 parents f84ab62 + 5bfc142 commit 3fce0fc

File tree

4 files changed

+10
-18
lines changed

4 files changed

+10
-18
lines changed

lib/pkp

Submodule pkp updated 79 files

plugins/metadata/dc11/filter/Dc11SchemaPreprintAdapter.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use APP\submission\Submission;
2929
use PKP\db\DAORegistry;
3030
use PKP\facades\Locale;
31-
use PKP\i18n\LocaleConversion;
3231
use PKP\metadata\MetadataDataObjectAdapter;
3332
use PKP\metadata\MetadataDescription;
3433
use PKP\plugins\Hook;
@@ -59,6 +58,7 @@ public function &injectMetadataIntoDataObject(&$metadataDescription, &$targetDat
5958
* @param Submission $submission
6059
*
6160
* @return MetadataDescription
61+
*
6262
* @hook Dc11SchemaPreprintAdapter::extractMetadataFromDataObject [[$this, $submission, $server, &$dc11Description]]
6363
*/
6464
public function &extractMetadataFromDataObject(&$submission)
@@ -145,20 +145,12 @@ public function &extractMetadataFromDataObject(&$submission)
145145
$dc11Description->addStatement('dc:identifier', $request->url($server->getPath(), 'preprint', 'view', [$submission->getBestId()]));
146146

147147
// Language
148-
$locales = [];
149-
foreach ($galleys as $galley) {
150-
$galleyLocale = $galley->getLocale();
151-
if (!is_null($galleyLocale) && !in_array($galleyLocale, $locales)) {
152-
$locales[] = $galleyLocale;
153-
$dc11Description->addStatement('dc:language', LocaleConversion::getIso3FromLocale($galleyLocale));
154-
}
155-
}
156-
$submissionLanguages = $submission->getLanguage();
157-
if (empty($locales) && isset($submissionLanguages[$submission->getLocale()])) {
158-
foreach ($submissionLanguages[$submission->getLocale()] as $language) {
159-
$dc11Description->addStatement('dc:language', $language);
160-
}
161-
}
148+
collect($galleys)
149+
->map(fn ($g) => $g->getData('locale'))
150+
->push($publication->getData('locale'))
151+
->filter()
152+
->unique()
153+
->each(fn ($l) => $dc11Description->addStatement('dc:language', $l));
162154

163155
// Relation
164156
// full text URLs

plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ public function testToXml()
101101
$publication->setData('abstract', 'preprint-abstract', 'en');
102102
$publication->setData('sponsor', 'preprint-sponsor', 'en');
103103
$publication->setData('doiObject', $publicationDoiObject);
104-
$publication->setData('languages', ['en' => ['en']]);
105104
$publication->setData('copyrightHolder', 'preprint-copyright');
106105
$publication->setData('copyrightYear', 'year');
107106
$publication->setData('datePublished', '2010-11-05');
@@ -144,6 +143,7 @@ public function testToXml()
144143
->will($this->returnValue(98));
145144
$galley->setId(98);
146145
$galley->setData('doiObject', $galleyDoiObject);
146+
$galley->setData('locale', 'en');
147147

148148
$galleys = [$galley];
149149

0 commit comments

Comments
 (0)