pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
299 stars 444 forks source link

Enable simultaneous display of multilingual metadata #7272

Open asmecher opened 3 years ago

asmecher commented 3 years ago

Describe the problem you would like to solve From the Coalition Publica metadata working group:

One of the most frequent issues with metadata is that users will enter more than one language into a single field because they want both to display. If users could selectively display more than one language for some metadata elements, we would certainly see a decrease in metadata abuse. Abstracts are an excellent example. It is very common to see two languages in a single abstract field because a journal wants to show both abstracts on an article landing page. For example, an English-language journal may have very little additional metadata or website copy available in French, but they want to provide French abstracts for English articles so that their Francophone readers can decide if they want to take the time reader an article in English. This example could be equally true for a French-language journal, or for other metadata fields such as title and keywords.

Describe the solution you'd like Rather than displaying only the current language's metadata, with a fallback on the primary language, permit the display of metadata in both languages on the same page.

This might need to be treated differently depending on the context. For example, it's common for an article landing page to present information in two languages at once (e.g. French and English) for titles and abstracts. For other fields (e.g. keywords) it might be better to introduce a visual indication that other languages may be available, with a way to toggle that display.

Who is asking for this feature? Coalition Publica metadata working group

Additional information From the recommenation: "Simultaneous Display of Multilingual Metadata"

NateWr commented 3 years ago

I'd like to see this implemented on a per-theme basis. We can implement it as a theme option in the default theme and some of the others without too much difficulty.

fgnievinski commented 2 years ago

the simultaneous display of multilingual metadata might ensure that all languages are indexable by crawlers #699

fgnievinski commented 2 years ago

a solution has been reported in the forum:

https://forum.pkp.sfu.ca/t/option-to-have-article-abstracts-and-titles-in-multiple-languages/33220/3

see a live example:

https://digitcult.lim.di.unimi.it/index.php/dc/article/view/191

NateWr commented 2 years ago

Just noting that the lang attribute should be used to ensure that a screen reader can read text in languages other than the one specified in the <body> tag.

fgnievinski commented 2 years ago

Multilingual DC tags could also be used, e.g.,:

<meta name="DC.Language" scheme="ISO639-1" content="it"/>
<meta name="DC.Title" content=" Intervista con Catherine D’Ignazio: Data Feminism nella storia urbana e nel patrimonio"/>
<meta name="DC.Title.Alternative" xml:lang="en" content=" Interview with Catherine D’Ignazio:  Data Feminism for Cultural Heritage and Urban History"/>

Although not used by Google Scholar, they could be useful for general Google Search.

luca-ludovico commented 2 years ago

a solution has been reported in the forum: https://forum.pkp.sfu.ca/t/option-to-have-article-abstracts-and-titles-in-multiple-languages/33220/3 see a live example: https://digitcult.lim.di.unimi.it/index.php/dc/article/view/191

Dear all, here is the code we wrote for DigitCult. Let me recall the behaviour we had to implement. We usually publish articles in Italian; in this case, we require that the title, subtitle, and abstract are made available in English too, and we display them in a smaller size. We also accept papers originally written in English; in this case, we just show the English version. A good example is available here: https://digitcult.lim.di.unimi.it/index.php/dc/issue/view/13 (most papers in Italian, a few papers in English).

Basically, you have to modify two files:

  1. \templates\frontend\objects\article_summary.tpl
  2. \templates\frontend\objects\article_details.tpl

The references to $article->getLocalizedTitle() and ->getLocalizedAbstract() have to be modified into loops on the data structures resulting from article->getTitle() and ->getAbstract(), which are arrays. You can iterate over them through foreach statements, e.g. if you don't know how many languages you have to manage, or simply target the languages you are interested in, as in our scenario.

In our case, the first file - article_summary.tpl - has been transformed into:

<div class="title">
    <a href="{url page="article" op="view" path=$articlePath}">
    {assign var="titleIta" value=$article->getTitle("it_IT")}
    {assign var="titleEng" value=$article->getTitle("en_US")}
    {if $titleIta|count_characters > 0}
        {$titleIta|strip_unsafe_html}<br /><small>
    {/if}
    {$titleEng|strip_unsafe_html}
    {if $titleIta|count_characters > 0}
        </small>
    {/if}
    </a>
</div>

In the second file - article_details.tpl - please note that the code lines reported below are not continuous, there is a gap where you see the sequence "..."

<article class="obj_article_details">
{assign var="titleIta" value=$article->getTitle("it_IT")}
{assign var="titleEng" value=$article->getTitle("en_US")}
{assign var="subtitleIta" value=$article->getSubtitle("it_IT")}
{assign var="subtitleEng" value=$article->getSubtitle("en_US")}

<h1 class="page_title">
    {if $titleIta|count_characters > 0}
        {$titleIta|escape}
    {/if}
</h1>
{if $subtitleIta|count_characters > 0}
    <h2 class="subtitle">
        {$subtitleIta|escape}
    </h2>
{/if}
<h1 class="page_title">
{if $titleEng|count_characters > 0}
    {$titleEng|escape}
{/if}
</h1>
{if $subtitleEng|count_characters > 0}
    <h2 class="subtitle">
        {$subtitleEng|escape}
    </h2>
{/if}

...

{* Abstract *}
{assign var="abstractIta" value=$article->getAbstract("it_IT")}
{assign var="abstractEng" value=$article->getAbstract("en_US")}

{if $abstractIta|count_characters > 0}
    <div class="item abstract">
        <h3 class="label">Abstract [ita]</h3>
        {$abstractIta|nl2br}
    </div>
{/if}
{if $abstractEng|count_characters > 0}
    <div class="item abstract">
        <h3 class="label">Abstract [eng]</h3>
        {$abstractEng|nl2br}
    </div>
{/if}
fgnievinski commented 2 years ago

Attaching the modified .tpl files for download: rpkpojsoptiontohavearticleabstractsandtitlesin.zip

fgnievinski commented 1 year ago

I just realized CrossRef already supports multiple titles in different languages, e.g.:

<titles>
<title>When your best metadata isn't good enough: working with an imperfect specification</title>
</titles>
<titles language="fr">
<title>Quand vos meilleures métadonnées ne suffisent pas: travailler avec une spécification imparfaite</title>
</titles>

background: https://community.crossref.org/t/multi-language-support/3054/9

support for exporting multilingual metadata, even for single-language articles, is a frequent discussion forum topic, e.g.: https://forum.pkp.sfu.ca/t/ojs-3-crossref-and-metadata-in-different-languages/50977 https://forum.pkp.sfu.ca/t/crossref-export-plugin-does-not-export-the-data-in-the-original-language/23368/7 https://forum.pkp.sfu.ca/t/ojs-does-the-crossref-export-plugin-registeres-doi-with-two-titles/3929

edit: actually, crossref doesn't fully support titles in multiple languages; it does support additional titles, but their language is undefined: https://community.crossref.org/t/multi-language-support/3054/17

asmecher commented 11 months ago

PRs from @jyhein:

jyhein commented 11 months ago

Issue description

One of the most frequent issues with metadata is that editors will enter content with more than one language into a single field because they want all the data visible for the reader without the need to switch the UI language. For smaller languages, it is for example very common to write an English abstract for the article. It is likely common to see two languages in a single abstract field because the editor wants to show both abstracts on an article landing page. This example could be equally true for other metadata fields such as title and keywords. It means that although visually working, the language encoding does not match the content. For some search engines like Google this does not make a difference, because it will ignore the HTML lang attribute in any case, but other crawlers like Bing will take these into account. However, this is a major problem when the metadata is sent upstream ie. to other services and also for screen readers.

Changes

The suggested solution is to build a set of theme options in the Default theme in OJS/OMP/OPS that enable the simultaneous display of specified metadata fields in the Landing page by simply defining those fields and editing the theme settings. The implementation in the Default theme can then be used as an example in theme development. If required, additions to the core ThemePlugin functionality are added.

The attached PR's includes the following code changes:

<hgroup> <h1>Title</h1> <h2>Subtitle</h2 </hgroup> <hgroup id aria-label="Article titles in other languages"> <h2 lang="fi">Suomenkielinen otsikko - Suomenkielinen alaotsikko</h2> <h2 lang="fr">Titre en français - Sous-titre en français</h2> </hgroup>

PRs:

OJS: https://github.com/pkp/ojs/pull/4050 OPS: https://github.com/pkp/ops/pull/574 OMP: https://github.com/pkp/omp/pull/1466

jyhein commented 11 months ago

Separate title groups for primary language (UI or submission language) and other languages. Aria attributes are for screen readers. The example is just a suggestion that may need to be changed.

<hgroup> <h1>Title</h1> <h2>Subtitle</h2> </hgroup> <hgroup id aria-label="Article titles in other languages"> <h2 lang="fi">Suomenkielinen otsikko - Suomenkielinen alaotsikko</h2> <h2 lang="fr">Titre en français - Sous-titre en français</h2> </hgroup>

Other choices:

The titles are as in the default theme. Titles in other languages are in their own section either directly under the titles or directly above keywords.

<h1>Title</h1> <h2>Subtitle</h2

Then:

1. <section> <h2 lang="en">Article titles in other languages</h2> <p lang="fi">Suomenkielinen otsikko: Suomenkielinen alaotsikko</p> <p lang="fr">Titre en français: Sous-titre en français</p> </section>

OR

2. <section> <h2 lang="en">Article titles in other languages</h2> <ul> <li lang="fi">Suomenkielinen otsikko: Suomenkielinen alaotsikko</li> <li lang="fr">Titre en français: Sous-titre en français</li> </ul> </section>