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

  • Thread starter Thread starter ragtek
  • Start date Start date
This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.
R

ragtek

Guest
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...
 
Upvote 1
This suggestion has been closed. Votes are no longer accepted.
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 Bottom