Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Multiple languages [need help]
XTfan Offline
Junior Member
**
Posts: 3
Joined: Nov 2011
Post: #1
Multiple languages [need help]
From my understanding, MyBB does support multiple languages but only when using ONE at a time.

I want to have a section in English and one in a different language. I'm primarily interested in the user seeing the posting options in that other language, not really concerned about the translation spanning beyond that.

Below is what I did:

Using XThreads I was able to get the foreign language files and use the language conditional to get it to display the content in the other language which worked great. For those of you who are unaware of how to do this, you simply download the language pack and then manually add the language prefix to the language files that you need if you're looking for a quick solution like what I did. So for German, add de_forumdisplay.php etc. then define de_ as your conditional.

If you know of a better implementation and are willing to share, I'm all ears but this seemed to work fine for my purposes.

My problem:
I can't figure out how to change the New Thread button to other language as the workaround above only addresses text, not images. I did a search in the language translation files and don't really see where this is defined.

Would appreciate some help with this.
(This post was last modified: 11-15-2011 04:14 PM by XTfan.)
11-15-2011 04:14 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: Multiple languages [need help]
Interesting solution, but yeah, an ugly hack.
You could theoretically go through all the templates containing a button image, make a copy and use prefix overrides, but that's even more messy.

Here's a less ugly hack, find in inc/plugins/xthreads.php:

PHP Code:
if($xtforum['langprefix'] !== '') {

add before

PHP Code:
1
2
3
4
5
6
7
8
			if(@in_array('de_', $xtforum['langprefix'])) {
				$xtforum['langprefix'] = '';
				global $lang;
				$mybb->settings['bblanguage'] = 'german';
				$lang->set_language('german');
				$lang->load('global');
				$lang->load('messages');
			}

(change relevant parts of course)

Basically, if the language prefix is 'de_', it'll force the forum language to German.
(untested)


My Blog
(This post was last modified: 11-18-2011 09:52 PM by ZiNgA BuRgA.)
11-15-2011 07:01 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #3
RE: Multiple languages [need help]
Maybe adding a option to xthreads that will allow us to choose different language for different subforums could be done Zinga Burga?

Just like there is already a option to force postbit layouts.

Or maybe it costs more that what it is useful for..?

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
11-16-2011 06:06 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #4
RE: Multiple languages [need help]
I really don't see the point in it for most situations.

My Blog
11-16-2011 08:37 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #5
RE: Multiple languages [need help]
(11-16-2011 08:37 AM)ZiNgA BuRgA Wrote:  I really don't see the point in it for most situations.

Well, yeah, that is what I meant, you are mostly right.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
11-16-2011 12:55 PM
Visit this user's website Find all posts by this user Quote this message in a reply
XTfan Offline
Junior Member
**
Posts: 3
Joined: Nov 2011
Post: #6
RE: Multiple languages [need help]
I tried that but now every page on the forum shows up as blank unless I undo the code edits...

I installed the language file as well the correct way and I know that does work as I can select in the User CP.

I also tried getting rid of the language prefix in the XThread settings to see if that solved it, and the same issue.
(This post was last modified: 11-17-2011 03:23 PM by XTfan.)
11-17-2011 03:21 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #7
RE: Multiple languages [need help]
Err, I missed a dollar sign in the above edit lol.
Sorry, try the above edit now.

My Blog
11-17-2011 08:01 PM
Find all posts by this user Quote this message in a reply
XTfan Offline
Junior Member
**
Posts: 3
Joined: Nov 2011
Post: #8
RE: Multiple languages [need help]
It doesn't show a blank page anymore Smile

However, it still doesn't work unfortunately. I also made sure I had put the actual values as for formal German for instance, you wouldn't actually type in 'german' I believe as you'd have to use the name that the language PHP file uses which would be deutsch_sie (for formal German) instead.

On the bright side, it seems like I discovered another dirty workaround for what I wanted to do. I made a new global template called xx_forumdisplay_newthread with this code in it:

PHP Code:
<a href="newthread.php?fid={$fid}"><img src="{$mybb->settings['bburl']}/images/language_name/newthread.gif" alt="{$lang->post_thread}" title="{$lang->post_thread}" /></a>


What you would do is replace xx_ with the appropriate prefix and in the XThread options for that forum you would also add the prefix to the template in addition to the language. In the above code, you'd also swap out language_name with the name of the language from the image folder.

Thanks for the help though as it guided me in the right direction although as stated before, I'm still open to a better solution as this one's far from perfect but at least it's functional from the results I got.

If anyone is planning on using this solution for their own use and something was unclear, let me know and I'll try to clarify the instructions more.

11-18-2011 11:44 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #9
RE: Multiple languages [need help]
The problem with just editing one template is that it doesn't affect the postbit / new reply buttons.  If you only need to change the new thread button, then that's fine.

EDIT: okay, got the time to test it, and found the problem.  Sorry for the issues - try the above code edit again.
Thanks.

My Blog
(This post was last modified: 11-18-2011 09:53 PM by ZiNgA BuRgA.)
11-18-2011 03:38 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: