That's not how translate()
works. When you translate:
translate('minutes seconds','hours','uur')
the expected result is:
minrte ecund
because you are actually telling the processor to replace the occurrences of the first three letters in the second argument:
'h', 'o', 'u'
as they occur in the string 'minutes seconds' with the corresponding characters
'u', 'u', 'r'
respectively, and remove the characters 'r'
and 's'
, since they have no corresponding replacements in the third argument.
If you want to replace full words, and are using XPath 2.0, then you can use the replace()
function.
replace(replace(replace(replace('1 day 23 hours 30 minutes 25 seconds','day','dag'),'hours','uur'),'minutes','minuut'),'seconds','seconden')