Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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 the default integration setup and functioning before modifying it further.

Primo Integration (Multiple Language Support) Overview

The default Primo integration script sets up LibKey integration links in Primo in a single language. We have been in touch with some of our subscribers who have 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 uses en for English and cy for Welsh along with English and Welsh phrasing for the text. 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 = {
          api: "https://public-api.thirdiron.com/public/v1/libraries/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,

        };
      } else {
        window.browzine = {
          api: "https://public-api.thirdiron.com/public/v1/libraries/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,
		  
        };
      }
  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('browzineController', function ($scope) {
    window.browzine.primo.searchResult($scope);
  });

  app.component('prmSearchResultAvailabilityLineAfter', {
    bindings: { parentCtrl: '<' },
    controller: 'browzineController',
    template: '<prm-toc-link parent-ctrl="$ctrl.parentCtrl"></prm-toc-link>'
  });
  //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.

  • No labels