Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/part-names-key: fix translation of part-names if they are not in … #511

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions add/data/xqm/eutil.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let $string :=
if($file//entry[@key = $key])
then (
$file//entry[@key = $key]/string(@value)
) else (
'noValueFound'
)
let $projectFile := doc(edition:getLanguageFileURI($edition, $lang))
let $projectString := $projectFile//entry[@key = $key]
let $ediromString := $file//entry[@key = $key]
let $string := if($projectString) then $projectString else $ediromString

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combined with the suggested return statement this could work! But I haven’t tested it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if i add
let $edition := request:get-parameter('edition', '')
it kind of does, but i guess not as intended: it will print the right values but it looks like the edition lang-file won't be found. probably i'm missing something?

should we ignore the custom edition lang-file for now (aka just use the suggested return statement) and come back to this for 1.1.0?

let $string := functx:replace-multi($string, for $i in (0 to (count($values) - 1)) return concat('\{',$i,'\}'), $values)

return
Expand Down
Loading