Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 script scripts below. It The first script is, in essence, two copies of the integration code using two different languages for the display text. There is also an additional piece of scripting to look for these language codes and to use them to tell the script which version to load.

Again, our 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.:

Code Block
languagejs
  // 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:

Code Block
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 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.