MyBB Community Forums

Full Version: Changing theme's language?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Well, I am trying to implement custom images without overwriting the MyBB default ones, and I can do this all with templates EXCEPT I discovered that the images in the Memberlist are coded into that file with the $theme[imglangdir] in the image URL. I need to find out how to change this, as I really want to change those images. Thanks!
There is no need to change the directories in the templates. You can enter the path to your images folder in the theme settings so all you need is to put your images into a new folder on your webspace.

If you want to do it your way the variable $theme[imglangdir] gets replaced by "images/language". For example: images/english.
Actually:
$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];

The individual language folder should be a subdirectory of the theme's image directory.
Yes it should be. But it's not. Are you saying that it is?

Please explain. Am I suppose to place that code somewhere?
In you theme editing screen you can specify the image directory for that theme (ie images/mytheme). Thanks to code already in MyBB, $theme['imglangdir'] will get set to the proper subdirectory of the image theme directory based on the user's selected language (ie images/mytheme/english). This is all done automatically Big Grin
But it doesn't. The postbits do NOT work via the language. Instead they go to the images directory. There is a bug here. Maybe I will track it down better.
Can you try this fix:

Open: global.php
Find:
// Check if a custom language directory exists for this theme
if(is_dir($theme['imgdir'].'/'.$mybb->settings['bblanguage']))
{
	$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}
// Otherwise, the image language directory is the same as the language directory for the theme
else
{
	$theme['imglangdir'] = $theme['imgdir'];
}
Replace with:
// If a language directory for the current language exists within the theme - we use it
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language']))
{
	$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
	// Check if a custom language directory exists for this theme
	if(is_dir($theme['imgdir'].'/'.$mybb->settings['bblanguage']))
	{
		$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
	}
	// Otherwise, the image language directory is the same as the language directory for the theme
	else
	{
		$theme['imglangdir'] = $theme['imgdir'];
	}
}

See if that works.
Thanks..I will let you know my results. If this works will it be added to code base?