Skip to content

Commit

Permalink
Support for localized disclaimers #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Nguyen committed Dec 12, 2024
1 parent 4057686 commit 62d40b0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
7 changes: 4 additions & 3 deletions add/data/xql/getMeasures.xql
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import module namespace console="http://exist-db.org/xquery/console";

declare option exist:serialize "method=text media-type=text/plain omit-xml-declaration=yes";

declare function local:getMeasures($mei as node(), $mdivID as xs:string) as xs:string* {
declare function local:getMeasures($mei as node(), $mdivID as xs:string, $lang as xs:string) as xs:string* {

let $disclaimer := $mei//mei:pubStmt//mei:useRestrict[@type = 'disclaimer']/string() => replace('\n', '<br>')
let $disclaimer := $mei//mei:pubStmt//mei:useRestrict[@type = 'disclaimer'][if (./@xml:lang) then (./@xml:lang = $lang) else (.)]/string() => replace('\n', '<br>')

return if($mei//mei:parts)
then(
Expand Down Expand Up @@ -110,8 +110,9 @@ declare function local:getMeasures($mei as node(), $mdivID as xs:string) as xs:s

let $uri := request:get-parameter('uri', '')
let $mdivID := request:get-parameter('mdiv', '')
let $lang := request:get-parameter('lang', 'en')
let $mei := doc($uri)/root()

let $ret := local:getMeasures($mei, $mdivID)
let $ret := local:getMeasures($mei, $mdivID, $lang)

return concat('[', string-join($ret, ','), ']')
3 changes: 2 additions & 1 deletion add/data/xql/getPages.xql
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ declare namespace xmldb="http://exist-db.org/xquery/xmldb";
declare option exist:serialize "method=text media-type=text/plain omit-xml-declaration=yes";

let $uri := request:get-parameter('uri', '')
let $lang := request:get-parameter('lang', 'en')
let $mei := eutil:getDoc($uri)/root()

let $disclaimer := $mei//mei:pubStmt//mei:useRestrict[@type = 'disclaimer']/string() => replace('\n', '<br>')
let $disclaimer := $mei//mei:pubStmt//mei:useRestrict[@type = 'disclaimer'][if (./@xml:lang) then (./@xml:lang = $lang) else (.)]/string() => replace('\n', '<br>')

let $ret := for $surface in $mei//mei:surface
(:let $image := doc($surface/mei:graphic[@type='facsimile']/string(@target))/img:image:)
Expand Down
3 changes: 2 additions & 1 deletion app/controller/window/source/MeasureBasedView.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ Ext.define('EdiromOnline.controller.window.source.MeasureBasedView', {
method: 'GET',
params: {
uri: view.owner.uri,
mdiv: mdiv
mdiv: mdiv,
lang: getPreference('application_language')
},
success: function(response){
var data = response.responseText;
Expand Down
3 changes: 2 additions & 1 deletion app/controller/window/source/PageBasedView.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Ext.define('EdiromOnline.controller.window.source.PageBasedView', {
url: 'data/xql/getPages.xql',
method: 'GET',
params: {
uri: view.owner.uri
uri: view.owner.uri,
lang: getPreference('application_language')
},
success: function(response){
var data = response.responseText;
Expand Down
3 changes: 2 additions & 1 deletion app/controller/window/text/FacsimileView.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Ext.define('EdiromOnline.controller.window.text.FacsimileView', {
url: 'data/xql/getPages.xql',
method: 'GET',
params: {
uri: uri
uri: uri,
lang: getPreference('application_language')
},
success: function(response){
var data = response.responseText;
Expand Down
3 changes: 2 additions & 1 deletion app/controller/window/text/TextFacsimileSplitView.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Ext.define('EdiromOnline.controller.window.text.TextFacsimileSplitView', {
url: 'data/xql/getPages.xql',
method: 'GET',
params: {
uri: uri
uri: uri,
lang: getPreference('application_language')
},
success: function(response){
var data = response.responseText;
Expand Down

0 comments on commit 62d40b0

Please sign in to comment.