(:
Module: Language menus.
Returns all available languages for a dictionary,
or for all collections if input argument is "all".
:)
module namespace langmenu="http://www.risten.no/shared/langmenu";
declare namespace util="http://exist-db.org/xquery/util";
(: Get all language codes registered in all or the specified collection :)
(: Returns a sequence of empty elements with the following structure:
:)
declare function langmenu:get-termlangs($coll as xs:string) as element()
{
let $langs := if ($coll = "all") then
/termmeta/langs/*
else
collection($coll)/termmeta/langs/*
return
{
for $r in distinct-values($langs)
order by $r descending
return
}
};
(: Get all language codes registered in the specified class collection :)
(: Returns a sequence of empty elements with the following structure:
:)
declare function langmenu:get-classlangs($coll as xs:string) as element()
{
let $langs := collection($coll)/classmeta/langs/*
return
{
for $r in distinct-values($langs)
order by $r descending
return
}
};
(: Get all language codes registered in all public collections :)
(: Returns a sequence of empty elements with the following structure:
:)
declare function langmenu:get-publangs() as element()
{
let $langs := /(termmeta|dictmeta)[public eq 'yes']/langs/*
return
{
for $r in distinct-values($langs)
order by $r descending
return
}
};