Primo Integration (Multiple Language Support)

Please review our general guide on the https://thirdiron.atlassian.net/wiki/spaces/BrowZineAPIDocs/pages/79200260/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_US for English and cy_GB 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_US for English and cy_GB 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:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 // Begin BrowZine - Primo Integration... var primolang = location.search.match(/lang=cy_GB/) ? 'cy_GB' : 'en_US'; if (primolang == "cy_GB") { 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 will 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_US for English and cy_GB for Welsh, but please insert the language codes you are using where appropriate:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 var currentPage = window.location.href; var primolang = location.search.match(/lang=cy_GB/) ? 'cy_GB' : 'en_US'; // listen for changes setInterval(function () { var checkLang = location.search.match(/lang=cy_GB/) ? 'cy_GB' : 'en_US'; 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 https://thirdiron.atlassian.net/wiki/spaces/BrowZineAPIDocs/pages/79200260/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.