From f95676a03b7a2d99692d51664e43d6ee527c84b3 Mon Sep 17 00:00:00 2001 From: jyhein <124268211+jyhein@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:33:23 +0200 Subject: [PATCH] Simultaneously Displaying Multilingual Metadata on the Article Landing Page --- pages/article/ArticleHandler.php | 84 ++++++++++++++++++- plugins/themes/default/DefaultThemePlugin.php | 20 +++++ plugins/themes/default/locale/ar/locale.po | 4 + plugins/themes/default/locale/az/locale.po | 4 + plugins/themes/default/locale/bg/locale.po | 4 + plugins/themes/default/locale/bs/locale.po | 4 + plugins/themes/default/locale/ca/locale.po | 4 + plugins/themes/default/locale/ckb/locale.po | 4 + plugins/themes/default/locale/cs/locale.po | 4 + plugins/themes/default/locale/da/locale.po | 4 + plugins/themes/default/locale/de/locale.po | 4 + plugins/themes/default/locale/el/locale.po | 4 + plugins/themes/default/locale/en/locale.po | 12 +++ plugins/themes/default/locale/es/locale.po | 4 + plugins/themes/default/locale/es_MX/locale.po | 4 + plugins/themes/default/locale/fa/locale.po | 4 + plugins/themes/default/locale/fi/locale.po | 4 + plugins/themes/default/locale/fr_CA/locale.po | 4 + plugins/themes/default/locale/fr_FR/locale.po | 4 + plugins/themes/default/locale/gl/locale.po | 4 + plugins/themes/default/locale/hu/locale.po | 4 + plugins/themes/default/locale/hy/locale.po | 4 + plugins/themes/default/locale/id/locale.po | 4 + plugins/themes/default/locale/it/locale.po | 4 + plugins/themes/default/locale/ja/locale.po | 4 + plugins/themes/default/locale/ka/locale.po | 4 + plugins/themes/default/locale/kk/locale.po | 4 + plugins/themes/default/locale/ko/locale.po | 4 + plugins/themes/default/locale/lv/locale.po | 4 + plugins/themes/default/locale/mk/locale.po | 4 + plugins/themes/default/locale/ms/locale.po | 4 + plugins/themes/default/locale/nb/locale.po | 4 + plugins/themes/default/locale/nl/locale.po | 4 + plugins/themes/default/locale/pl/locale.po | 4 + plugins/themes/default/locale/pt_BR/locale.po | 4 + plugins/themes/default/locale/pt_PT/locale.po | 4 + plugins/themes/default/locale/ro/locale.po | 4 + plugins/themes/default/locale/ru/locale.po | 4 + plugins/themes/default/locale/sk/locale.po | 4 + plugins/themes/default/locale/sl/locale.po | 4 + .../themes/default/locale/sr@latin/locale.po | 4 + plugins/themes/default/locale/sv/locale.po | 4 + plugins/themes/default/locale/tr/locale.po | 4 + plugins/themes/default/locale/uk/locale.po | 4 + .../themes/default/locale/uz@latin/locale.po | 4 + plugins/themes/default/locale/vi/locale.po | 4 + plugins/themes/default/locale/zh_CN/locale.po | 4 + .../themes/default/locale/zh_Hant/locale.po | 4 + .../styles/objects/article_details.less | 15 ++-- .../frontend/objects/article_details.tpl | 83 ++++++++++++------ 50 files changed, 359 insertions(+), 35 deletions(-) diff --git a/pages/article/ArticleHandler.php b/pages/article/ArticleHandler.php index 07f6bfb8505..e21871364e3 100644 --- a/pages/article/ArticleHandler.php +++ b/pages/article/ArticleHandler.php @@ -25,6 +25,7 @@ use APP\observers\events\UsageEvent; use APP\payment\ojs\OJSCompletedPaymentDAO; use APP\payment\ojs\OJSPaymentManager; +use APP\publication\Publication; use APP\security\authorization\OjsJournalMustPublishPolicy; use APP\submission\Submission; use APP\template\TemplateManager; @@ -38,6 +39,7 @@ use PKP\plugins\PluginRegistry; use PKP\security\authorization\ContextRequiredPolicy; use PKP\security\Validation; +use PKP\services\PKPSchemaService; use PKP\submission\Genre; use PKP\submission\GenreDAO; use PKP\submission\PKPSubmission; @@ -167,8 +169,8 @@ public function initialize($request, $args = []) $this->galley = $galley; break; - // In some cases, a URL to a galley may use the ID when it should use - // the urlPath. Redirect to the galley's correct URL. + // In some cases, a URL to a galley may use the ID when it should use + // the urlPath. Redirect to the galley's correct URL. } elseif (ctype_digit($galleyId) && $galley->getId() == $galleyId) { $request->redirect(null, $request->getRequestedPage(), $request->getRequestedOp(), [$submission->getBestId(), $galley->getBestGalleyId()]); } @@ -357,6 +359,13 @@ public function view($args, $request) $templateMgr->assign('purchaseArticleEnabled', true); } + $templateMgr->assign('pubLocaleData', $this->getPublicationMetadata( + $publication, + $templateMgr->getTemplateVars('currentLocale'), + $templateMgr->getTemplateVars('activeTheme')->getOption('showMultilingualMetadata') ?: [], + $templateMgr->getTemplateVars('activeTheme')->getOption('showMetadata') ?: [] + )); + if (!Hook::call('ArticleHandler::view', [&$request, &$issue, &$article, $publication])) { $templateMgr->display('frontend/pages/article.tpl'); event(new UsageEvent(Application::ASSOC_TYPE_SUBMISSION, $context, $article, null, null, $this->issue)); @@ -616,4 +625,75 @@ public function userCanViewGalley($request, $articleId, $galleyId = null) } return true; } + + /** + * Multilingual publication metadata for template: + * If 0 multilingual metadata options selected, use the default multilingual metadata display + */ + protected function getPublicationMetadata(Publication $publication, string $currentUILocale, array $showMultilingualMetadataOpts, array $showMetadataOpts): array + { + $pubLocaleData = collect($this->getPublicationLocaleData($publication, $currentUILocale, $showMultilingualMetadataOpts, $showMetadataOpts)); + + if (!empty(count($showMultilingualMetadataOpts))) { + return $pubLocaleData->toArray(); + } + + // Exclude titles, languages, and titleLocale to get metadata options + $metadataOpts = $pubLocaleData->keys()->diff(['title', 'subtitle', 'fullTitle', 'languages', 'titleLocale']); + + // Use getLocalizedData to add metadata in some other language if missing in title's locale + $metadataOpts->each(function (string $opt) use ($pubLocaleData, $publication, $currentUILocale): void { + if (empty(count($pubLocaleData->get($opt)['text']))) { + $locale = $pubLocaleData->get('titleLocale'); + $data = $publication->getLocalizedData($opt, $locale, $locale); + $pubLocaleData->when(isset($data), fn ($pld) => $pld->put($opt, [ + 'text' => [$locale => $data], 'headingLang' => [$locale => $currentUILocale], + ])); + } + }); + + return $pubLocaleData + // Reorder languages to match the order of $metadataOpts + ->put('languages', $metadataOpts->map(fn (string $opt): ?string => array_key_first($pubLocaleData->get($opt)['text'])) + ->filter()->unique()->values()) + ->put('displayDefault', true) + ->toArray(); + } + + /** + * Multilingual publication metadata for template: + * Default metadata at least includes: full title, title, subtitle, keywords, abstract + * showMultilingualMetadataOpts adds multilingual metadata: title (by default includes fullTitle and subtitle), keywords, abstract, etc. + * showMetadataOpts: additional metadata + */ + protected function getPublicationLocaleData(Publication $publication, string $currentUILocale, array $showMultilingualMetadataOpts, array $showMetadataOpts): array + { + $titles = collect([ + 'title' => $publication->getTitles('html'), + 'subtitle' => $publication->getSubtitles('html'), + 'fullTitle' => $publication->getFullTitles('html'), + ]); + $defaultMdata = collect(['keywords', 'abstract']); + $metadataOpts = $defaultMdata->concat($showMetadataOpts) + ->filter(fn ($opt) => in_array($opt, Services::get('schema')->getMultilingualProps(PKPSchemaService::SCHEMA_PUBLICATION))) + ->unique()->diff($titles->keys())->values(); + $multilingualOpts = collect($showMultilingualMetadataOpts) + ->when(in_array('title', $showMultilingualMetadataOpts), fn ($m) => $m->concat($titles->keys())->unique()->values()); + $titleLocale = isset($titles->get('title')[$currentUILocale]) ? $currentUILocale : $publication->getData('locale'); + + $getText = fn (array $item, string $opt): array => [ + $opt => [ + 'text' => ($text = array_filter($item, fn (string $locale) => $multilingualOpts->contains($opt) || $locale === $titleLocale, ARRAY_FILTER_USE_KEY)), + 'headingLang' => collect($text)->map(fn ($_, string $locale): string => $locale === $titleLocale ? $currentUILocale : $locale) + ], + ]; + + $pubLocaleData = $titles->mapWithKeys($getText) + ->union($metadataOpts->mapWithKeys(fn (string $opt): array => $getText($publication->getData($opt) ?? [], $opt))); + return $pubLocaleData + ->put('languages', $pubLocaleData->map(fn (array $item): array => array_keys($item['text'])) + ->flatten()->sort()->prepend($titleLocale)->unique()->values()) + ->put('titleLocale', $titleLocale) + ->toArray(); + } } diff --git a/plugins/themes/default/DefaultThemePlugin.php b/plugins/themes/default/DefaultThemePlugin.php index 6ebcb1f4424..3f641004319 100644 --- a/plugins/themes/default/DefaultThemePlugin.php +++ b/plugins/themes/default/DefaultThemePlugin.php @@ -124,6 +124,26 @@ public function init() 'default' => 'none', ]); + $this->addOption('showMultilingualMetadata', 'FieldOptions', [ + 'label' => __('plugins.themes.default.option.metadata.label'), + 'description' => __('plugins.themes.default.option.metadata.description'), + 'options' => [ + [ + 'value' => 'title', + 'label' => __('submission.title'), + ], + [ + 'value' => 'keywords', + 'label' => __('common.keywords'), + ], + [ + 'value' => 'abstract', + 'label' => __('common.abstract'), + ], + ], + 'default' => [], + ]); + // Load primary stylesheet $this->addStyle('stylesheet', 'styles/index.less'); diff --git a/plugins/themes/default/locale/ar/locale.po b/plugins/themes/default/locale/ar/locale.po index 6edfc630447..b90cb925edd 100644 --- a/plugins/themes/default/locale/ar/locale.po +++ b/plugins/themes/default/locale/ar/locale.po @@ -87,3 +87,7 @@ msgstr "التنزيلات" msgid "plugins.themes.default.displayStats.noStats" msgstr "تنزيل البيانات ليس متاحًا بعد." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/az/locale.po b/plugins/themes/default/locale/az/locale.po index f1e3c866e9c..bf6872ea658 100644 --- a/plugins/themes/default/locale/az/locale.po +++ b/plugins/themes/default/locale/az/locale.po @@ -95,3 +95,7 @@ msgid "plugins.themes.default.option.useHomepageImageAsHeader.description" msgstr "" "Bir ana səhifə şəkli yükləndiyində, ana səhifədəki normal başlıq yerinə " "başlığın arxa planında baxın." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/bg/locale.po b/plugins/themes/default/locale/bg/locale.po index a4dc9c01e0c..bde56c92b3f 100644 --- a/plugins/themes/default/locale/bg/locale.po +++ b/plugins/themes/default/locale/bg/locale.po @@ -101,3 +101,7 @@ msgstr "Сваляния" msgid "plugins.themes.default.displayStats.noStats" msgstr "Данните за свалянията все още не са налични." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/bs/locale.po b/plugins/themes/default/locale/bs/locale.po index 032bc10be80..72cba850ac1 100644 --- a/plugins/themes/default/locale/bs/locale.po +++ b/plugins/themes/default/locale/bs/locale.po @@ -93,3 +93,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ca/locale.po b/plugins/themes/default/locale/ca/locale.po index f5814c969d4..e3993a63f36 100644 --- a/plugins/themes/default/locale/ca/locale.po +++ b/plugins/themes/default/locale/ca/locale.po @@ -93,3 +93,7 @@ msgstr "Descàrregues" msgid "plugins.themes.default.displayStats.noStats" msgstr "Les dades de descàrrega encara no estan disponibles." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ckb/locale.po b/plugins/themes/default/locale/ckb/locale.po index 0d206c38f69..ae46d362f7c 100644 --- a/plugins/themes/default/locale/ckb/locale.po +++ b/plugins/themes/default/locale/ckb/locale.po @@ -92,3 +92,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/cs/locale.po b/plugins/themes/default/locale/cs/locale.po index 29be7c84941..2cd8439e19b 100644 --- a/plugins/themes/default/locale/cs/locale.po +++ b/plugins/themes/default/locale/cs/locale.po @@ -96,3 +96,7 @@ msgstr "Stažení" msgid "plugins.themes.default.displayStats.noStats" msgstr "Údaje o počtu stažení nejsou zatím k dispozici." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/da/locale.po b/plugins/themes/default/locale/da/locale.po index 535e9a70100..a9e546dbcaf 100644 --- a/plugins/themes/default/locale/da/locale.po +++ b/plugins/themes/default/locale/da/locale.po @@ -96,3 +96,7 @@ msgstr "Downloads" msgid "plugins.themes.default.displayStats.noStats" msgstr "Download-data er endnu ikke tilgængelige." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/de/locale.po b/plugins/themes/default/locale/de/locale.po index e7843b46c0d..9b3b370a95d 100644 --- a/plugins/themes/default/locale/de/locale.po +++ b/plugins/themes/default/locale/de/locale.po @@ -97,3 +97,7 @@ msgstr "Downloads" msgid "plugins.themes.default.displayStats.noStats" msgstr "Download-Daten sind nocht nicht verfügbar." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/el/locale.po b/plugins/themes/default/locale/el/locale.po index 182c98d40c3..bdffb05237a 100644 --- a/plugins/themes/default/locale/el/locale.po +++ b/plugins/themes/default/locale/el/locale.po @@ -101,3 +101,7 @@ msgstr "" msgid "plugins.themes.default.option.displayStats.none" msgstr "" "Να μην εμφανίζονται στατιστικά στοιχεία χρήσης υποβολής για τον αναγνώστη." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/en/locale.po b/plugins/themes/default/locale/en/locale.po index c783e630ff5..ca1511b3132 100644 --- a/plugins/themes/default/locale/en/locale.po +++ b/plugins/themes/default/locale/en/locale.po @@ -98,3 +98,15 @@ msgstr "Next slide" msgid "plugins.themes.default.prevSlide" msgstr "Previous slide" + +msgid "plugins.themes.default.option.metadata.label" +msgstr "Show article metadata on the article landing page" + +msgid "plugins.themes.default.option.metadata.description" +msgstr "Select the article metadata to show in other languages." + +msgid "plugins.themes.default.submissionMetadataInLanguage" +msgstr "Article Metadata in English" + +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/es/locale.po b/plugins/themes/default/locale/es/locale.po index 3145a96e116..ba611d0a764 100644 --- a/plugins/themes/default/locale/es/locale.po +++ b/plugins/themes/default/locale/es/locale.po @@ -96,3 +96,7 @@ msgstr "Descargas" msgid "plugins.themes.default.displayStats.noStats" msgstr "Los datos de descarga aún no están disponibles." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/es_MX/locale.po b/plugins/themes/default/locale/es_MX/locale.po index 385b3f2a58b..8cb7022a762 100644 --- a/plugins/themes/default/locale/es_MX/locale.po +++ b/plugins/themes/default/locale/es_MX/locale.po @@ -91,3 +91,7 @@ msgstr "Descargas" msgid "plugins.themes.default.displayStats.noStats" msgstr "Los datos de descarga aún no están disponibles." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/fa/locale.po b/plugins/themes/default/locale/fa/locale.po index 3fd24dbb7e7..3c76da48f61 100644 --- a/plugins/themes/default/locale/fa/locale.po +++ b/plugins/themes/default/locale/fa/locale.po @@ -92,3 +92,7 @@ msgstr "دانلودها" msgid "plugins.themes.default.displayStats.noStats" msgstr "دسترسی به دانلود اطلاعات مقدور نیست." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/fi/locale.po b/plugins/themes/default/locale/fi/locale.po index 22169ec90c4..1a5db88f044 100644 --- a/plugins/themes/default/locale/fi/locale.po +++ b/plugins/themes/default/locale/fi/locale.po @@ -97,3 +97,7 @@ msgstr "Lataukset" msgid "plugins.themes.default.displayStats.noStats" msgstr "Lataustiedot eivät ole vielä saatavilla." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/fr_CA/locale.po b/plugins/themes/default/locale/fr_CA/locale.po index 11fedd37451..2092d39aa23 100644 --- a/plugins/themes/default/locale/fr_CA/locale.po +++ b/plugins/themes/default/locale/fr_CA/locale.po @@ -110,3 +110,7 @@ msgstr "Les données de téléchargement ne sont pas encore disponible." #~ msgid "plugins.themes.default.option.showDescriptionInJournalIndex.label" #~ msgstr "Description de la revue" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/fr_FR/locale.po b/plugins/themes/default/locale/fr_FR/locale.po index 2e1148bb565..e6dcea6f8d1 100644 --- a/plugins/themes/default/locale/fr_FR/locale.po +++ b/plugins/themes/default/locale/fr_FR/locale.po @@ -95,3 +95,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/gl/locale.po b/plugins/themes/default/locale/gl/locale.po index b254a4122ff..81327138f13 100644 --- a/plugins/themes/default/locale/gl/locale.po +++ b/plugins/themes/default/locale/gl/locale.po @@ -92,3 +92,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/hu/locale.po b/plugins/themes/default/locale/hu/locale.po index f23af1a290e..a2bd318d2ce 100644 --- a/plugins/themes/default/locale/hu/locale.po +++ b/plugins/themes/default/locale/hu/locale.po @@ -97,3 +97,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/hy/locale.po b/plugins/themes/default/locale/hy/locale.po index be2eff4d35d..cc623d80570 100644 --- a/plugins/themes/default/locale/hy/locale.po +++ b/plugins/themes/default/locale/hy/locale.po @@ -100,3 +100,7 @@ msgstr "Ներբեռնումներ" msgid "plugins.themes.default.displayStats.noStats" msgstr "Ներբեռնման տվյալները դեռ հասանելի չեն:" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/id/locale.po b/plugins/themes/default/locale/id/locale.po index 0af641f1bcc..7ccd0d56853 100644 --- a/plugins/themes/default/locale/id/locale.po +++ b/plugins/themes/default/locale/id/locale.po @@ -94,3 +94,7 @@ msgstr "Unduhan" msgid "plugins.themes.default.displayStats.noStats" msgstr "Data unduhan tidak tersedia." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/it/locale.po b/plugins/themes/default/locale/it/locale.po index 79e7929a989..9fc508c2093 100644 --- a/plugins/themes/default/locale/it/locale.po +++ b/plugins/themes/default/locale/it/locale.po @@ -101,3 +101,7 @@ msgstr "Downloads" msgid "plugins.themes.default.displayStats.noStats" msgstr "La data di download non è ancora disponibile." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ja/locale.po b/plugins/themes/default/locale/ja/locale.po index ed874966b1d..787c8d5c96c 100644 --- a/plugins/themes/default/locale/ja/locale.po +++ b/plugins/themes/default/locale/ja/locale.po @@ -92,3 +92,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ka/locale.po b/plugins/themes/default/locale/ka/locale.po index a6188c750b1..6dfa3170cd6 100644 --- a/plugins/themes/default/locale/ka/locale.po +++ b/plugins/themes/default/locale/ka/locale.po @@ -92,3 +92,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/kk/locale.po b/plugins/themes/default/locale/kk/locale.po index 26cb7cb624b..1c92e3b5ee2 100644 --- a/plugins/themes/default/locale/kk/locale.po +++ b/plugins/themes/default/locale/kk/locale.po @@ -91,3 +91,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ko/locale.po b/plugins/themes/default/locale/ko/locale.po index cb62bba2a7b..ee63b4ce436 100644 --- a/plugins/themes/default/locale/ko/locale.po +++ b/plugins/themes/default/locale/ko/locale.po @@ -89,3 +89,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/lv/locale.po b/plugins/themes/default/locale/lv/locale.po index 6a5cd7d57be..eadfa8cb6a8 100644 --- a/plugins/themes/default/locale/lv/locale.po +++ b/plugins/themes/default/locale/lv/locale.po @@ -96,3 +96,7 @@ msgstr "Lejupielādes" msgid "plugins.themes.default.displayStats.noStats" msgstr "Lejupielādes dati vēl nav pieejami." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/mk/locale.po b/plugins/themes/default/locale/mk/locale.po index 3b20fe6a041..e9dfd3d0af2 100644 --- a/plugins/themes/default/locale/mk/locale.po +++ b/plugins/themes/default/locale/mk/locale.po @@ -94,3 +94,7 @@ msgstr "Превземања" msgid "plugins.themes.default.displayStats.noStats" msgstr "Податоците за превземање не се сè уште достапни." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ms/locale.po b/plugins/themes/default/locale/ms/locale.po index 72a31998655..4fd6eee53a9 100644 --- a/plugins/themes/default/locale/ms/locale.po +++ b/plugins/themes/default/locale/ms/locale.po @@ -94,3 +94,7 @@ msgstr "Muat turun" msgid "plugins.themes.default.displayStats.noStats" msgstr "Muat turun data belum tersedia." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/nb/locale.po b/plugins/themes/default/locale/nb/locale.po index fff9363a54f..4ec49edd90b 100644 --- a/plugins/themes/default/locale/nb/locale.po +++ b/plugins/themes/default/locale/nb/locale.po @@ -96,3 +96,7 @@ msgstr "Nedlastinger" msgid "plugins.themes.default.displayStats.noStats" msgstr "Nedlastingsdata er foreløpig ikke tilgjengelig." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/nl/locale.po b/plugins/themes/default/locale/nl/locale.po index 277445ed6f5..afe15b63992 100644 --- a/plugins/themes/default/locale/nl/locale.po +++ b/plugins/themes/default/locale/nl/locale.po @@ -95,3 +95,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/pl/locale.po b/plugins/themes/default/locale/pl/locale.po index d9257a0d70d..d7a4a42174a 100644 --- a/plugins/themes/default/locale/pl/locale.po +++ b/plugins/themes/default/locale/pl/locale.po @@ -98,3 +98,7 @@ msgstr "Pobrania" msgid "plugins.themes.default.displayStats.noStats" msgstr "Statystyki pobrań niedostępne." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/pt_BR/locale.po b/plugins/themes/default/locale/pt_BR/locale.po index a54e5315dc8..95b0261262f 100644 --- a/plugins/themes/default/locale/pt_BR/locale.po +++ b/plugins/themes/default/locale/pt_BR/locale.po @@ -96,3 +96,7 @@ msgstr "Downloads" msgid "plugins.themes.default.displayStats.noStats" msgstr "Os dados de download ainda não estão disponíveis." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/pt_PT/locale.po b/plugins/themes/default/locale/pt_PT/locale.po index 8d7740ada98..8f878f2f937 100644 --- a/plugins/themes/default/locale/pt_PT/locale.po +++ b/plugins/themes/default/locale/pt_PT/locale.po @@ -96,3 +96,7 @@ msgstr "Downloads" msgid "plugins.themes.default.displayStats.noStats" msgstr "Os dados de download ainda não estão disponíveis." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ro/locale.po b/plugins/themes/default/locale/ro/locale.po index 48ab7ddeef7..9ff92bc7dbd 100644 --- a/plugins/themes/default/locale/ro/locale.po +++ b/plugins/themes/default/locale/ro/locale.po @@ -93,3 +93,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/ru/locale.po b/plugins/themes/default/locale/ru/locale.po index aa084a34cb3..d0ccdb6cee5 100644 --- a/plugins/themes/default/locale/ru/locale.po +++ b/plugins/themes/default/locale/ru/locale.po @@ -98,3 +98,7 @@ msgstr "Скачивания" msgid "plugins.themes.default.displayStats.noStats" msgstr "Данные по скачиваниям пока не доступны." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/sk/locale.po b/plugins/themes/default/locale/sk/locale.po index bc02cd45725..18faca316f0 100644 --- a/plugins/themes/default/locale/sk/locale.po +++ b/plugins/themes/default/locale/sk/locale.po @@ -92,3 +92,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/sl/locale.po b/plugins/themes/default/locale/sl/locale.po index 230c95fb3e3..aa7bc4c99f2 100644 --- a/plugins/themes/default/locale/sl/locale.po +++ b/plugins/themes/default/locale/sl/locale.po @@ -94,3 +94,7 @@ msgstr "Prenosi" msgid "plugins.themes.default.displayStats.noStats" msgstr "Podatki o prenosih še niso na voljo." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/sr@latin/locale.po b/plugins/themes/default/locale/sr@latin/locale.po index 5bb27040368..205fd53ad20 100644 --- a/plugins/themes/default/locale/sr@latin/locale.po +++ b/plugins/themes/default/locale/sr@latin/locale.po @@ -86,3 +86,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/sv/locale.po b/plugins/themes/default/locale/sv/locale.po index a4343c75e8c..c5d374a838b 100644 --- a/plugins/themes/default/locale/sv/locale.po +++ b/plugins/themes/default/locale/sv/locale.po @@ -96,3 +96,7 @@ msgstr "Nedladdningar" msgid "plugins.themes.default.displayStats.noStats" msgstr "Nedladdningsstatistik är inte tillgänglig ännu." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/tr/locale.po b/plugins/themes/default/locale/tr/locale.po index 8a8eb47a341..08b82116151 100644 --- a/plugins/themes/default/locale/tr/locale.po +++ b/plugins/themes/default/locale/tr/locale.po @@ -98,3 +98,7 @@ msgstr "İndirmeler" msgid "plugins.themes.default.displayStats.noStats" msgstr "İndirme verisi henüz mevcut değil." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/uk/locale.po b/plugins/themes/default/locale/uk/locale.po index 3a4e3e7a0c0..f77029fc2fb 100644 --- a/plugins/themes/default/locale/uk/locale.po +++ b/plugins/themes/default/locale/uk/locale.po @@ -104,3 +104,7 @@ msgstr "Завантажити" msgid "plugins.themes.default.displayStats.noStats" msgstr "Дані для завантаження поки недоступні." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/uz@latin/locale.po b/plugins/themes/default/locale/uz@latin/locale.po index 56decf289e6..7a1e044a26b 100644 --- a/plugins/themes/default/locale/uz@latin/locale.po +++ b/plugins/themes/default/locale/uz@latin/locale.po @@ -98,3 +98,7 @@ msgstr "Yuklashlar" msgid "plugins.themes.default.displayStats.noStats" msgstr "Yuklab olish maʼlumotlari hali mavjud emas." + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/vi/locale.po b/plugins/themes/default/locale/vi/locale.po index abc7ee66b05..b32ed1127e6 100644 --- a/plugins/themes/default/locale/vi/locale.po +++ b/plugins/themes/default/locale/vi/locale.po @@ -93,3 +93,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/zh_CN/locale.po b/plugins/themes/default/locale/zh_CN/locale.po index a667a12b4aa..82c84f34c7a 100644 --- a/plugins/themes/default/locale/zh_CN/locale.po +++ b/plugins/themes/default/locale/zh_CN/locale.po @@ -83,3 +83,7 @@ msgstr "" msgid "plugins.themes.default.displayStats.noStats" msgstr "" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/locale/zh_Hant/locale.po b/plugins/themes/default/locale/zh_Hant/locale.po index 05ddc90eb09..94b9a53b780 100644 --- a/plugins/themes/default/locale/zh_Hant/locale.po +++ b/plugins/themes/default/locale/zh_Hant/locale.po @@ -83,3 +83,7 @@ msgstr "下載" msgid "plugins.themes.default.displayStats.noStats" msgstr "尚未有下載數據。" + +#, fuzzy +msgid "plugins.themes.default.titleSubtitleSeparator" +msgstr " — " diff --git a/plugins/themes/default/styles/objects/article_details.less b/plugins/themes/default/styles/objects/article_details.less index d8c032b0a0d..85f9291cba3 100644 --- a/plugins/themes/default/styles/objects/article_details.less +++ b/plugins/themes/default/styles/objects/article_details.less @@ -37,7 +37,7 @@ margin-bottom: 0; } - > h2 + p { + > h2 + p, h3 + p { margin-top: 0; } } @@ -52,6 +52,10 @@ .main_entry { + .metadata > .page_metadata_title { + margin: 0; + } + .item { .label { @@ -61,8 +65,7 @@ font-weight: @bold; } - &.doi .label, - &.keywords .label { + &.doi .label { display: inline; font-size: @font-base; } @@ -127,8 +130,7 @@ } } - .item.doi, - .item.keywords { + .item.doi { padding-top: 0; } @@ -315,8 +317,7 @@ font-weight: @bold; } - &.doi .label, - &.keywords .label { + &.doi .label { display: inline; font-size: @font-base; } diff --git a/templates/frontend/objects/article_details.tpl b/templates/frontend/objects/article_details.tpl index 4b6b1463e1b..910d3ef6659 100755 --- a/templates/frontend/objects/article_details.tpl +++ b/templates/frontend/objects/article_details.tpl @@ -64,6 +64,7 @@ * @uses $licenseUrl string URL to license. Only assigned if license should be * included with published submissions. * @uses $ccLicenseBadge string An image and text with details about the license + * @uses $pubLocaleData array Array of formatted publication locale metadata: titles, abstracts, keywords, * * @hook Templates::Article::Main [] * @hook Templates::Article::Details::Reference [] @@ -91,13 +92,12 @@ {/if} -

- {$publication->getLocalizedTitle(null, 'html')|strip_unsafe_html} +

+ {$pubLocaleData.title.text[$pubLocaleData.titleLocale]|strip_unsafe_html}

- - {if $publication->getLocalizedData('subtitle')} -

- {$publication->getLocalizedSubTitle(null, 'html')|strip_unsafe_html} + {if isset($pubLocaleData.subtitle.text[$pubLocaleData.titleLocale])} +

+ {$pubLocaleData.subtitle.text[$pubLocaleData.titleLocale]|strip_unsafe_html}

{/if} @@ -160,29 +160,60 @@ {/if} + {* + * Show article keywords and abstract in ui, or submission, language by default. + * Show optional multilingual metadata: titles, keywords, abstracts. + *} + {foreach from=$pubLocaleData.languages item=lang} +
+ {assign "hLvl" "2"} + {* Multilingual metadata title *} + {if $lang !== $pubLocaleData.titleLocale && !isset($pubLocaleData.displayDefault)} + {assign "hLvl" "3"} +

+ {translate key="plugins.themes.default.submissionMetadataInLanguage" locale=$lang} +

+ {* Title in other language *} + {if isset($pubLocaleData.title.text[$lang])} +
+ + {translate key="submission.title" locale=$pubLocaleData.title.headingLang[$lang]} + +

+ {$pubLocaleData.title.text[$lang]|strip_tags} + {if isset($pubLocaleData.subtitle.text[$lang])} + {translate key="plugins.themes.default.titleSubtitleSeparator" locale=$pubLocaleData.title.headingLang[$lang]}{$pubLocaleData.subtitle.text[$lang]|strip_tags} + {/if} +

+
+ {/if} + {/if} - {* Keywords *} - {if !empty($publication->getLocalizedData('keywords'))} -
-

- {capture assign=translatedKeywords}{translate key="article.subject"}{/capture} - {translate key="semicolon" label=$translatedKeywords} -

- - {foreach name="keywords" from=$publication->getLocalizedData('keywords') item="keyword"} - {$keyword|escape}{if !$smarty.foreach.keywords.last}{translate key="common.commaListSeparator"}{/if} - {/foreach} - -
- {/if} + {* Keywords *} + {if isset($pubLocaleData.keywords.text[$lang])} +
+ + {translate key="common.keywords" locale=$pubLocaleData.keywords.headingLang[$lang]} + +

+ {foreach from=$pubLocaleData.keywords.text[$lang] item="keyword"} + {$keyword|escape}{if !$keyword@last}{translate key="common.commaListSeparator" locale=$pubLocaleData.keywords.headingLang[$lang]}{/if} + {/foreach} +

+
+ {/if} - {* Abstract *} - {if $publication->getLocalizedData('abstract')} -
-

{translate key="article.abstract"}

- {$publication->getLocalizedData('abstract')|strip_unsafe_html} + {* Abstract *} + {if isset($pubLocaleData.abstract.text[$lang])} +
+ + {translate key="common.abstract" locale=$pubLocaleData.abstract.headingLang[$lang]} + +

{$pubLocaleData.abstract.text[$lang]|strip_tags}

+
+ {/if}
- {/if} + {/foreach} {call_hook name="Templates::Article::Main"}