In the context of translating some strings, I came across the need to look up a term in a Data Dictionary (x-tiddler-dictionary) and return the result. Which is what I’d suspect to be one of the natural functions of a dictionary tiddler.
However, I couldn’t find a filter operator that does something like this:
[[‹index name›]operator[‹dictionary title›]]
i.e. that takes an index and looks it up in the tiddler that is given as parameter to the operator, only the other way around (getindex[]).
I did find a workaround like this:
\define translate() [all[]] :map[[‹dictionary title›]getindex<currentTiddler>else<currentTiddler>]
{{{ [[‹index name›]subfilter<translate>]
The :map filter run prefix wasn’t available before v5.2.0, though, so there would’ve been another way? I could imagine setting a variable to ‹index name› and then using getindex[] with a soft parameter, but that seems even more convoluted. Therefore, I’m thinking I might have missed something in the docs. Did I?
Have a nice day
Yaisog