How to - Customize LibKey Discovery labels according to the language of Primo UI
Created By: François Renaville
Created on: 6/23/2020
LibKey Discovery labels proposed in the default javascript code for Primo don't support multilingual interfaces. Using the default code will necessarily display the same labels whatever the selected language of Primo UI.
You can customize the labels by removing/commenting the following lines from the default code:
journalBrowZineWebLinkText: "View Journal Contents", articleBrowZineWebLinkText: "View Issue Contents", articlePDFDownloadLinkText: "Download PDF", articleLinkText: "Read Article", articlePDFDownloadViaUnpaywallText: "Download PDF (via Unpaywall)", articleLinkViaUnpaywallText: "Read Article (via Unpaywall)", articleAcceptedManuscriptPDFViaUnpaywallText: "Download PDF (Accepted Manuscript via Unpaywall)", articleAcceptedManuscriptArticleLinkViaUnpaywallText: "Read Article (Accepted Manuscript via Unpaywall)",
and by updating section:
app.controller('prmSearchResultAvailabilityLineAfterController', function($scope) { window.browzine.primo.searchResult($scope); });
like here below. Just put the desired language codes under 'case', translate the labels and select default labels to display in case there is no language parameter in the URL:
- for Primo VE (ISO 639-1) : en, fr, de...
- for Primo BO : en_US, fr_FR, de_DE...
Code example:
app.controller('prmSearchResultAvailabilityLineAfterController', function ($scope) { var expr = $scope.$ctrl.parentCtrl.$stateParams.lang; switch (expr) { case 'en': window.browzine.journalBrowZineWebLinkText = "View Journal Contents"; window.browzine.articleBrowZineWebLinkText = "View Issue Contents"; window.browzine.articlePDFDownloadLinkText = "Download PDF"; window.browzine.articleLinkText = "Read Article"; window.browzine.articlePDFDownloadViaUnpaywallText = "Download PDF (via Unpaywall)"; window.browzine.articleLinkViaUnpaywallText = "Read Article (via Unpaywall)"; window.browzine.articleAcceptedManuscriptPDFViaUnpaywallText = "Download PDF (Accepted Manuscript via Unpaywall)"; window.browzine.articleAcceptedManuscriptArticleLinkViaUnpaywallText = "Read Article (Accepted Manuscript via Unpaywall)"; break; case 'fr': window.browzine.journalBrowZineWebLinkText = "Contenu du périodique"; window.browzine.articleBrowZineWebLinkText = "Contenu du fascicule"; window.browzine.articlePDFDownloadLinkText = "PDF en 1 clic"; window.browzine.articleLinkText = "Lire l'article"; window.browzine.articlePDFDownloadViaUnpaywallText = "PDF en 1 clic (via Unpaywall)"; window.browzine.articleLinkViaUnpaywallText = "Lire l'article (via Unpaywall)"; window.browzine.articleAcceptedManuscriptPDFViaUnpaywallText = "PDF en 1 clic (version acceptée via Unpaywall)"; window.browzine.articleAcceptedManuscriptArticleLinkViaUnpaywallText = "Lire l'article (version acceptée via Unpaywall)"; break; default: window.browzine.journalBrowZineWebLinkText = "Contenu du périodique"; window.browzine.articleBrowZineWebLinkText = "Contenu du fascicule"; window.browzine.articlePDFDownloadLinkText = "PDF en 1 clic"; window.browzine.articleLinkText = "Lire l'article"; window.browzine.articlePDFDownloadViaUnpaywallText = "PDF en 1 clic (via Unpaywall)"; window.browzine.articleLinkViaUnpaywallText = "Lire l'article (via Unpaywall)"; window.browzine.articleAcceptedManuscriptPDFViaUnpaywallText = "PDF en 1 clic (version acceptée via Unpaywall)"; window.browzine.articleAcceptedManuscriptArticleLinkViaUnpaywallText = "Lire l'article (version acceptée via Unpaywall)"; break; } window.browzine.primo.searchResult($scope); });