Add And Use Custom Phrase Type.
How to add
Simple, just use these 2 lines in your install code, it will add a new phrase type with phrasegroup_name = tm_phrase, phrasegroup_title = trademanager and productid as trademanager. PHP Code:
PHP Code:
How to use In your script, after: PHP Code:
PHP Code:
Now you can use the phrases from "Trade Manager" phrase group to your script. How this helps ? I can think of these for now: - Prevent spamming the global phrases, make it getting bigger and bigger. - Easier to manage. Because it's your own custom phrases ;) - Make your product more like a product :P. Notice - These phrases can only use to replace global phrase. Meaning, instead of create all of them and put to Global phrase, you put it in your own group. So if you want to use them for Permissions, Error Messages, etc. you simply can't. Correct me if I missed something. Have fun. wiritten by deathemperor @ www.holvn.org |
really great modification. i used it myself.
|
I have some questions:
1. How to completely delete all phrases of my plugin on uninstallation? Is this done automatically? 2. Quote:
BTW, isn't add_phrase_type deprecated yet? As I can see, for example psiStats addon for VB does not use this function, but still uses custom phrases |
1. Yes when: for example when you add a phrase, you choose a product it belongs to then when the product uninstalled the phrases belong to that product will be removed too.
2. I haven't found a way to add custom phrases for Permission, Error Messages, etc (which are some phrase types). So currently it's only possible to add global phrases. The psiStats may use queries in its product installation files (xml for example). add_phrase_type just do the same, it also runs queries but it's written by vbulletin development staves so what would you choose ? |
Thanks :) Now I understand.
|
Quote:
Thanks Jason |
actually I only tried it for new files. you can see it on vbulletin files, it's placed before everything (almost).
I think it will work on plugin if you use array_merge, I will try it myself. |
is there away to add a translation? i want to append some txt to an existing phrase.
|
All times are GMT. The time now is 06:30 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|