• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Modify phrase dynamically?

Kevin

Well-known member
#1
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.)
 

Jeremy

Well-known member
#2
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.
 

xf_phantom

Well-known member
#3
PHP:
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