How to Translate plugin
#1
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!
  
#2
One is sufficient.
https://community.mybb.com/thread-240824.html


Forum Jump:


Users browsing this thread: 1 Guest(s)