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
306 stars 445 forks source link

Improve galleyLabels for multilang journals #6275

Open marcbria opened 4 years ago

marcbria commented 4 years ago

**Describe the problem you would like to solve** The way the label of a galley is created (and the presentation) needs to be improved to fit better in multi-language journals.

Right now, if user's $currentLocale (navigation locale) is the same as the galley lang, you only get the label but, if is different, the locale of the galley will be concatenated after, getting labels as follows:

There are three problems here.

To start, the variable $galleyLabel that you can reach in galley_link.tpl is filled with "ArticleGalley::getGalleyLabel()" that is a wrapper method that automatically appends the language, hardcode the parenthesis... and this limits what you can do on the presentation layer.

Second, the logic behind adding those locales (hidden in currentLocale and forced in the rest) is not necessarily the way journals would like to work:

Finally, the locale naming is taken from locales.xml in registry and is the same for galleys, language selector, etc. when is not difficult to find scenarios where you would like to have different mapping for each part. For instance, I like to have galleys with shorter equivalences as follows:

Describe the solution you'd like

Who is asking for this feature? I think every journal publishing multilang galleys would be happy with an improvement in this.

NateWr commented 4 years ago

Thanks @marcbria. I agree we need to implement a translatable string that implements the parentheses, so that other languages can change it.

And we can also use the first two characters of a locale key (en_US) to get a better presentation of the language. That said, the locale key itself won't be translated. So for Chinese someone will see ZH and in Arabic they will see AR instead of seeing the appropriate character in that language's character set. Maybe what we need is for each locale to provide its own short language name.

Just a note that if people want to skip the language information in their own templates, they can edit galley_link.tpl and replace {$galley->getGalleyLabel()|escape} with {$galley->getLabel()|escape}. That will get just the label that's entered in.

asabharwal commented 3 years ago

@marcbria and @NateWr!

Thank you for this discussion. I have been looking for this information for the past couple of years, and you had the solution here. I would also like to thank @rcgillis for pointing me here.

I think, that the ISO language codes (either the 2 or 3-digit formats like EN or ENG) would be a better alternate to seeing fully spelled-out label albeit this should be a journal's choice that they should make when they add locale and language to the journal.

Question: will the next upgrade replace this modified file? I like to see PDF just appear as a universal galley label as not all Spanish speakers identify themselves with Spain. Many more Spanish speakers live in South America, but at l;east those languages that use Latin script will not need a translator to show PDF in their own language.

Again, thank you for the instructions @NateWr. I now only see PDF for our bi-lingual journal.

@asabharwal Arjun Sabharwal

marcbria commented 2 years ago

Related with #6080. Adressed in #7336.