2009-09-16, 05:36 PM
I posted this to the Ideas area, but thought I'd put it here to get more coverage as this issue is very important to me.
http://ideas.mybboard.net/idea/custom-la...ng-upgrade
Basically the suggestion is to have global.php read a custom language file that is not overwritten during an upgrade. In fact, the file will not be part of the provided files, but if it exists, it will be read during global.php so that the language variables are available in all parts of MyBB. This is not intended to be a replacement for plug-in specific language files, but for admin and global language changes that would otherwise be reverted during an upgrade.
A simple sample would be as follows:
The same can be done for the admin pages so that it works
I have done some additional looking into this and the $lang->load() function does already check if a file eixsts, so if the global.php fils just add a line like below, this will work. I just hope to avoid that having to edit core file after each upgrade.
I've submitted a plug-in for this feature in case anyone else is interested. I'll update this if/when it is validated.
http://ideas.mybboard.net/idea/custom-la...ng-upgrade
Basically the suggestion is to have global.php read a custom language file that is not overwritten during an upgrade. In fact, the file will not be part of the provided files, but if it exists, it will be read during global.php so that the language variables are available in all parts of MyBB. This is not intended to be a replacement for plug-in specific language files, but for admin and global language changes that would otherwise be reverted during an upgrade.
A simple sample would be as follows:
// Load language
$lang->set_language($mybb->settings['bblanguage']);
$lang->load("global");
$lang->load("messages");
if(file_exists('./inc/langauges/'.$mybb->settings['bblanguage'].'/custom.lang.php')
{
$lang->load("custom");
}
The same can be done for the admin pages so that it works
if(file_exists('./inc/langauges/'.$mybb->settings['bblanguage'].'/admin/custom.lang.php')
{
$lang->load("custom");
}
I have done some additional looking into this and the $lang->load() function does already check if a file eixsts, so if the global.php fils just add a line like below, this will work. I just hope to avoid that having to edit core file after each upgrade.
$lang->load("custom");
I've submitted a plug-in for this feature in case anyone else is interested. I'll update this if/when it is validated.