Lack of interest Easy way to add Phrases to the js phrases

R

ragtek

Guest
#1
It would be great, if we could add js phrases via an static method global from everywhere (controller, template hook,..)

For example:

XenForo_Helper::addPhraseToJS('ragtek_foo');

which would generate the code and insert it into the page_container_js_body phrases part
Code:
jQuery.extend(XenForo.phrases,
{
cancel: "{xen:jsescape {xen:phrase cancel}}",
(Coders are lazy;) )I don't like to use the page_container_js_body template hook and search replace there, only to add 1 phrase...
 
R

ragtek

Guest
#2
Example:

To add only 1 phrase i had to:

1. create a template
Code:
jQuery.extend(XenForo.phrases, { ragtek_show_user_details :  "{xen:jsescape {xen:phrase ragtek_show_user_details}}" });
2. create a template hook event listener to add this to the template
3. create a template create event listener, to cache the template

(ok, it would be possible to work with str_replace in template hook page_container_js_body but because of the bad experiance with other add-ons ( http://xenforo.com/community/threads/adding-links-to-the-visitor-tab.17953/ ) i'm trying to avoid this as much as possible)
 
Top