Modify phrase dynamically?


Well-known member
Has anybody modified a phrase yet dynamically at run-time? What I'd like to do is to globally modify a phrase dynamically from an add-on when it is active.

(I suspect the method is simple but it is late and I'm not thinking about it clearly enough at the moment.)


in memoriam 1991-2020
Quickly looking in XenForo_Phrase doesn't show anything that seems to allow run-time modifications besides adding to the params (done in code regardless) that'll allow variables in the phrases.


Well-known member
XenForo_Phrase::setPhrase('my_phrase_name', 'The new phrase value');
BUT this will work probably ONLY in the php scripts, because the phrases in the templates are already compiled into the template.

You'll probably need to use the post_render event and replace the old phrase value with the new one