From bd0ef6094121f33d5ef82ba2cba8ba411740283c Mon Sep 17 00:00:00 2001 From: Tobias Bachmann Date: Wed, 18 Dec 2024 22:12:13 +0100 Subject: [PATCH 1/2] fix/part-names-key: fix translation of part-names if they are not in lang-file. this commit is related to 741a51a Refs #502 --- add/data/xqm/eutil.xqm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/add/data/xqm/eutil.xqm b/add/data/xqm/eutil.xqm index 1d0cf76e5..f7be0abe9 100644 --- a/add/data/xqm/eutil.xqm +++ b/add/data/xqm/eutil.xqm @@ -224,7 +224,7 @@ declare function eutil:getPartLabel($measureOrPerfRes as node(), $type as xs:str let $dictKey := 'perfMedium.perfRes.' || functx:substring-before-if-contains($perfResLabel,'.') let $label := - if(eutil:getLanguageString($dictKey, (), $lang)) then + if(eutil:getLanguageString($dictKey, (), $lang) != 'noValueFound') then (eutil:getLanguageString($dictKey, (), $lang)) else ($perfResLabel) @@ -266,7 +266,13 @@ declare function eutil:getLanguageString($key as xs:string, $values as xs:string let $base := system:get-module-load-path() let $file := eutil:getDoc(concat($base, '/../locale/edirom-lang-', $lang, '.xml')) - let $string := $file//entry[@key = $key]/string(@value) + let $string := + if($file//entry[@key = $key]) + then ( + $file//entry[@key = $key]/string(@value) + ) else ( + 'noValueFound' + ) let $string := functx:replace-multi($string, for $i in (0 to (count($values) - 1)) return concat('\{',$i,'\}'), $values) return From 691a67d0d05c9d753f9dffafc80bf2210140083f Mon Sep 17 00:00:00 2001 From: Tobias Bachmann Date: Fri, 20 Dec 2024 02:34:43 +0100 Subject: [PATCH 2/2] fix/part-names-key: add more compact return query --- add/data/xqm/eutil.xqm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/add/data/xqm/eutil.xqm b/add/data/xqm/eutil.xqm index f7be0abe9..b9fb658e5 100644 --- a/add/data/xqm/eutil.xqm +++ b/add/data/xqm/eutil.xqm @@ -266,17 +266,11 @@ declare function eutil:getLanguageString($key as xs:string, $values as xs:string let $base := system:get-module-load-path() let $file := eutil:getDoc(concat($base, '/../locale/edirom-lang-', $lang, '.xml')) - let $string := - if($file//entry[@key = $key]) - then ( - $file//entry[@key = $key]/string(@value) - ) else ( - 'noValueFound' - ) + let $string := $file//entry[@key = $key]/string(@value) let $string := functx:replace-multi($string, for $i in (0 to (count($values) - 1)) return concat('\{',$i,'\}'), $values) return - $string + if($string) then $string else 'noValueFound' };