LP#1685840: Dojoless Google Books Preview: remove TT2 dependency
authorDan Scott <dscott@laurentian.ca>
Mon, 24 Apr 2017 15:53:24 +0000 (11:53 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 4 May 2017 14:31:27 +0000 (10:31 -0400)
Rather than process the template with TT2 to specify the language in
which the Google Books Preview should be displayed, use the @lang
attribute on the <html> element--and fall back to 'en' if for some
reason that attribute has been removed from the template.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Ben Shum <ben@evergreener.net>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>

Open-ILS/src/templates/opac/parts/ac_google_books.tt2

index 5632395..22f6963 100644 (file)
@@ -4,7 +4,10 @@
   var GBPBadgelink;
   var GBPreviewLink = '';
   var GBPreviewShowing = false;
-  var lang = '[% ctx.locale.substr(0,2) %]';
+  var lang = 'en';
+  if (document.documentElement.lang) {
+    lang = document.documentElement.lang.substr(0,2) || 'en';
+  }
   var head = document.getElementsByTagName('head')[0];
 
 /**