MyBB Community Forums

Full Version: How to Translate plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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!