Please review our general guide on the Ex Libris Primo Integration first! This guide will only explain the details related to setting up multiple language support in the script. It will work best to have one of the the non-multiple language versions installed (Option 1, 2 3, or 4 will work fine) and running first before looking into modifying it as demonstrated below.

Primo Integration (Multiple Language Support) Overview

The Primo integration scripts set up LibKey integration links in Primo in a single language. The library community has helped develop an integration script which can handle Primo instances offering multiple languages and ensure LibKey integration links are presented in the correct language for users.

To set this up, you will need to know the language codes associated with the languages your Primo offers. These can be found by switching between languages in Primo. Look for the lang= part of the URL when you switch between them.

In the example screenshots below, see how this lang= part of the URL uses en for English and cy for Welsh.

Example Multiple Language Support Integration Scripts

These language codes will then need to be inserted into the example scripts below. The first script is, in essence, two copies of the integration code using two different languages for the display text. There is an additional piece of scripting to look for these language codes and to use them to tell the script which version to load.

Our example below uses en for English and cy for Welsh along with English and Welsh phrasing for the text and has options configured per the “Option 1” setup on the main primo configuration page. If you are using different languages, please insert the language codes you are using and the phrasing you want in the same way shown below. You can also still customize the specific LibKey options and settings as desired:

  // Begin BrowZine - Primo Integration...	

     var primolang = location.search.match(/lang=cy/) ? 'cy' : 'en';
 
      if (primolang == "cy") {
        window.browzine = {
          libraryId: "XXX",
          apiKey: "ENTER API KEY",
          
          journalCoverImagesEnabled: true,
          
          journalBrowZineWebLinkTextEnabled: true,
          journalBrowZineWebLinkText: "Gweld Cynnwys y Cyfnodolyn",
          
          articleBrowZineWebLinkTextEnabled: true,          
          articleBrowZineWebLinkText: "Gweld Cynnwys y Rhifyn",
          
          articlePDFDownloadLinkEnabled: true,
          articlePDFDownloadLinkText: "Lawrlwytho Erthygl",
          
          articleLinkEnabled: true,
          articleLinkText: "Darllen Erthygl",
          
          printRecordsIntegrationEnabled: true,
                  
          showFormatChoice: false,
          showLinkResolverLink: true,
          enableLinkOptimizer: true,
          
          articleRetractionWatchEnabled: true,
          articleRetractionWatchText: "Erthygl wedi'i thynnu'n",
          
          articleExpressionOfConcernEnabled: true,
          articleExpressionOfConcernText: "Erthygl gyda phryderon",
          
          unpaywallEmailAddressKey: "enter-your-email@your-institution-domain.edu",
          
          articlePDFDownloadViaUnpaywallEnabled: true,
          articlePDFDownloadViaUnpaywallText: "Lawrlwytho Erthygl (trwy Unpaywall)",
          
          articleLinkViaUnpaywallEnabled: true,
          articleLinkViaUnpaywallText: "Darllen Erthygl (trwy Unpaywall)",
          
          articleAcceptedManuscriptPDFViaUnpaywallEnabled: true,
          articleAcceptedManuscriptPDFViaUnpaywallText: "Lawrlwytho Erthygl (Llawysgrif a Dderbyniwyd trwy Unpaywall)",

          articleAcceptedManuscriptArticleLinkViaUnpaywallEnabled: true,
          articleAcceptedManuscriptArticleLinkViaUnpaywallText: "Darllen Erthygl (Llawysgrif a Dderbyniwyd trwy Unpaywall)",
        };
      } else {
        window.browzine = {
          libraryId: "XXX",
          apiKey: "ENTER API KEY",
          
          journalCoverImagesEnabled: true,
          
          journalBrowZineWebLinkTextEnabled: true,
          journalBrowZineWebLinkText: "View Journal Contents",
          
          articleBrowZineWebLinkTextEnabled: true,
          articleBrowZineWebLinkText: "View Issue Contents",
          
          articlePDFDownloadLinkEnabled: true,
          articlePDFDownloadLinkText: "Download Article",
          
          articleLinkEnabled: true,
          articleLinkText: "Read Article",
          
          printRecordsIntegrationEnabled: true,
          
          showFormatChoice: false,
          showLinkResolverLink: true,
          enableLinkOptimizer: true,
          
          articleRetractionWatchEnabled: true,
          articleRetractionWatchText: "Retracted Article",
          
          articleExpressionOfConcernEnabled: true,
          articleExpressionOfConcernText: "Expression of Concern",
          
          unpaywallEmailAddressKey: "enter-your-email@your-institution-domain.edu",
          
          articlePDFDownloadViaUnpaywallEnabled: true,
          articlePDFDownloadViaUnpaywallText: "Download PDF (via Unpaywall)",
          
          articleLinkViaUnpaywallEnabled: true,
          articleLinkViaUnpaywallText: "Read Article (via Unpaywall)",
          
          articleAcceptedManuscriptPDFViaUnpaywallEnabled: true,
          articleAcceptedManuscriptPDFViaUnpaywallText: "Download PDF (Accepted Manuscript via Unpaywall)",  
                  
          articleAcceptedManuscriptArticleLinkViaUnpaywallEnabled: true,
          articleAcceptedManuscriptArticleLinkViaUnpaywallText: "Read Article (Accepted Manuscript via Unpaywall)",
        };
      }
  browzine.script = document.createElement("script");
  browzine.script.src = "https://s3.amazonaws.com/browzine-adapters/primo/browzine-primo-adapter.js";
  document.head.appendChild(browzine.script);

  //Continue Browzine
  app.controller('prmSearchResultAvailabilityLineAfterController', function($scope) {
    window.browzine.primo.searchResult($scope);
  });

  app.component('prmSearchResultAvailabilityLineAfter', {
    bindings: { parentCtrl: '<' },
    controller: 'prmSearchResultAvailabilityLineAfterController'
  });
  //End BrowZine

You may also need a second piece of scripting to ensure the page is reloaded with the correct language links if the user switches languages. An example of this script is below. We are again using en for English and cy for Welsh, but please insert the language codes you are using where appropriate:

var currentPage = window.location.href; 
var primolang = location.search.match(/lang=cy/) ? 'cy' : 'en';

// listen for changes 
setInterval(function () { 
var checkLang = location.search.match(/lang=cy/) ? 'cy' : 'en'; 
if (currentPage != window.location.href) {

//Lets check if there is a &lang in the URL 
if (window.location.href.indexOf("&lang=") > -1) { 
if (checkLang != primolang) { 
// page has changed, set new page as 'current' 
currentPage = window.location.href; 
document.location.reload(true); 
} else { 
currentPage = window.location.href; 
} 
} 
} 
}, 500);

After modifying your script to include both of the above, please upload and deploy it as covered in our main Ex Libris Primo Integration article. If you’re having problems seeing the integration or seeing the correct language text displayed after doing so, please contact us for assistance and include your script file as an attachment in your email.