vivo-project / VIVO

VIVO is an extensible semantic web application for research discovery and showcasing scholarly work
http://vivoweb.org
BSD 3-Clause "New" or "Revised" License
205 stars 127 forks source link

[3800 i18n redesign] Supporting private tags #3802

Closed chenejac closed 1 year ago

chenejac commented 1 year ago

VIVO GitHub issue: 3800

Companion PR

What does this pull request do?

Adding support for local customization of UI labels by using language tags. It means an institution can add in the directory /rdf/i18n/ its own local customization of translations. Those local, institution-specific translations should be in the directory which name is aligned with language tag specification for private tags (for instance fr_CA_x_uqam or de_DE_x_tib). The idea is similar as for property files and usage of webapps/i18n/local directory. The institution can easily update VIVO version, and continue to use previously customized labels and vocabularies.

What's new?

How should this be tested?

  1. Install VIVO
  2. Unzip this file into /rdf/i18n/
  3. Add into runtime properties languages.selectableLocales = en_US, fr_CA, fr_CA_x_uqam
  4. Run tomcat and open VIVO in a web browser
  5. Change language between the second and third language in the list
  6. At the home page you should found the label "Recherche" and "Recherche uqam" depends on selection of the French variant.
  7. If you login, you will also notice that logout option in the menu has been changed to "Déconnexion wilma uqam" when the last language has been selected
  8. Also, on some pages labels with uqam suffix will appear.

Example:

Interested parties

Tag (@ mention) interested parties or, if unsure, @VIVO-project/vivo-committers

michel-heon commented 1 year ago

@chenejac

In substance, the RP works. However, there are some problems.

  1. At startup the Tomcat log shows the following message:

2022-12-09 13:11:13,154 INFO [FileGraphSetup] Read 5 tbox file graphs 2022-12-09 13:11:13,154 INFO [FileGraphSetup] a full recompute of the Abox will be performed because the filegraph abox(s) and/or tbox(s) have changed or are being read for the first time. 2022-12-09 13:11:14,256 ERROR [UpdateKnowledgeBase] Unable to load RDF from UiLabelsVocabulary.nt org.apache.jena.riot.RiotException: [line: 1, col: 7 ] Element or attribute do not match QName production: QName::=(NCName':')?NCName.

There are two possible solutions:

a) in the directory rdf/tbox/firsttime/ rename UiLabelsVocabulary.nt to UiLabelsVocabulary.n3 or b) check if the UpdateKnowledgeBase class is able to read files with the nt extension (I recommend this solution)

  1. in the file en_CA_x_uqam.zip, proposed in the PR description. the file/fr_CA_x_uqam/tbox/firsttime/initialTBoxAnnotations_en_CA_x_uqam.nt contains an error that makes it unable to be read by VIVO.

Solutions: in the file, replace all the @fr_CA_x_uqam with @fr-CA-x-uqam , then the file is correctly loaded

  1. proposal: I suggest to put the content of fr_CA_x_uqam.zip in the repo -sample- which can serve as a template for an institution that wants to particularize the language. Of course, this can be referenced in the documentation.
litvinovg commented 1 year ago

Modification of fr CA labels while using #x-uqam results in replacement of fr CA label with new value. But that most likely out of scope for this PR.