![]() |
How to Translate plugin - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Extensions (https://community.mybb.com/forum-201.html) +--- Forum: Translations (https://community.mybb.com/forum-163.html) +---- Forum: Translation Discussion and Development (https://community.mybb.com/forum-21.html) +---- Thread: How to Translate plugin (/thread-240823.html) |
How to Translate plugin - baoziba - 2024-04-28 Hi I have a plugin with all the texts hard coded in English, and I'd like to support multiple languages, so I did the following to try to make it easier to translate to another language: 1) In the /inc folder, I added a "languages" folder and then an "english" folder. 2) I added a file in the "english" folder, called "myplugin.lang.php" with something like $l['myplugin_title'] = "This is an English title"; 3) At the beginning of the plugin file myplugin.php in /inc/plugins, I did the following: global $lang; $lang->load("myplugin"); 4) And then I tried to access the string value like {$lang->myplugin_title} in the php code of myplugin.php But, it doesn't work: on the page, it shows "{$lang->myplugin_title}" instead of "This is an English title". Anything I did wrong? Thanks! RE: How to Translate plugin - effone - 2024-04-28 One is sufficient. https://community.mybb.com/thread-240824.html |