MyBB Community Forums

Full Version: How do I write data to $lang?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I need to write something to $lang so that $lang->folder_chat returns Chat Logs.

How would I go about doing that?
Hi,
if you don't want to create a new language file you can add this line to

inc\languages\your language\global.lang.php

$l['folder_chat'] = 'Chat Logs';

When you have done this the string is avaible through $lang->folder_chat
Ahhhh, thank you very much, I couldn't find the file.

In fact, that clears up A LOT of my issues!

If I did want to make my own language file what would I do?

Would I have access through $lang->folder_chat still or would I need to do something else?
I recommend you to create your own language file and use $lang->load() to load it - make sure you pass your plugin's name as a string like $lang->load("my_plugin_name");
Gotcha, thanks!Wink
It is best to create your own because then a user doesn't have to make the changes when they do an upgrade or if they uninstall your plug-in.
It should be the plugin name or the .lang.php name? Or should they both be the same?
It should be named plugin_name.lang.php then you just use the $lang->load('plugin name'). In theory it could be named anything, but it is good practice to name it the same thing as your plug in name.
Many thanks, you all have been very helpful!

There appears to be 2 other parameters to load("string",bool,bool), any idea what they are for?
Pages: 1 2