Skip to content

Commit

Permalink
Merge pull request #22 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 b15fea7 + 3eb7756 commit 1189965
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions GoogleScholarPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use PKP\citation\CitationDAO;
use PKP\core\PKPApplication;
use PKP\db\DAORegistry;
use PKP\i18n\LocaleConversion;
use PKP\plugins\GenericPlugin;
use PKP\plugins\Hook;

Expand Down Expand Up @@ -123,7 +124,7 @@ public function submissionView($hookName, $args)
// Submission title
$templateMgr->addHeader('googleScholarTitle', '<meta name="citation_title" content="' . htmlspecialchars($publication->getLocalizedFullTitle($publicationLocale)) . '"/>');

$templateMgr->addHeader('googleScholarLanguage', '<meta name="citation_language" content="' . htmlspecialchars(substr($publicationLocale, 0, 2)) . '"/>');
$templateMgr->addHeader('googleScholarLanguage', '<meta name="citation_language" content="' . htmlspecialchars(str_replace(['_', '@'], '-', $publicationLocale)) . '"/>');

// Submission publish date and issue information
if ($applicationName == 'ojs2') {
Expand Down Expand Up @@ -173,14 +174,14 @@ public function submissionView($hookName, $args)

// Abstract
if ($abstract = $publication->getLocalizedData('abstract', $publicationLocale)) {
$templateMgr->addHeader('googleScholarAbstract', '<meta name="citation_abstract" xml:lang="' . htmlspecialchars(substr($publicationLocale, 0, 2)) . '" content="' . htmlspecialchars(strip_tags($abstract)) . '"/>');
$templateMgr->addHeader('googleScholarAbstract', '<meta name="citation_abstract" xml:lang="' . htmlspecialchars(str_replace(['_', '@'], '-', $publicationLocale)) . '" content="' . htmlspecialchars(strip_tags($abstract)) . '"/>');
}

// Subjects
if ($subjects = $publication->getData('subjects')) {
foreach ($subjects as $locale => $localeSubjects) {
foreach ($localeSubjects as $i => $subject) {
$templateMgr->addHeader('googleScholarSubject' . $i++, '<meta name="citation_keywords" xml:lang="' . htmlspecialchars(substr($locale, 0, 2)) . '" content="' . htmlspecialchars($subject) . '"/>');
$templateMgr->addHeader('googleScholarSubject' . $i++, '<meta name="citation_keywords" xml:lang="' . htmlspecialchars(str_replace(['_', '@'], '-', $locale)) . '" content="' . htmlspecialchars($subject) . '"/>');
}
}
}
Expand All @@ -189,7 +190,7 @@ public function submissionView($hookName, $args)
if ($keywords = $publication->getData('keywords')) {
foreach ($keywords as $locale => $localeKeywords) {
foreach ($localeKeywords as $i => $keyword) {
$templateMgr->addHeader('googleScholarKeyword' . $i++, '<meta name="citation_keywords" xml:lang="' . htmlspecialchars(substr($locale, 0, 2)) . '" content="' . htmlspecialchars($keyword) . '"/>');
$templateMgr->addHeader('googleScholarKeyword' . $i++, '<meta name="citation_keywords" xml:lang="' . htmlspecialchars(str_replace(['_', '@'], '-', $locale)) . '" content="' . htmlspecialchars($keyword) . '"/>');
}
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1189965

Please sign in to comment.