MyBB Community Forums
How to use a lang file in my plugin? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: How to use a lang file in my plugin? (/thread-170495.html)



How to use a lang file in my plugin? - Lektz - 2015-05-09

Hello

I'm creating my first plugin, so I have noob questions Blush

I want to add something like

function myportfolio_info() {
	return array(
		'name' => 'MyPortfolio',
		'description' => '$description',
);

Just to put an example, I know that it is not finished and that $description is not going to work.

So, I'd like to create a file called myportfolio.lang.php and add it to my english language folder, and then how could I load a variable from there? like $l['description'] = 'This should be the plugin description';

I hope you guys understand me Big Grin

Thanks for your time


RE: How to use a lang file in my plugin? - Crazycat - 2015-05-09

This is simple:
function myportfolio_info() {
   global $lang;
   $lang->load('myportfolio');
    return array(
        'name' => 'MyPortfolio',
        'description' => $lang->description,
);



RE: How to use a lang file in my plugin? - Lektz - 2015-05-09

Thank you so much Big Grin