Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How can the user switch the language of the q2a forum?

+3 votes
1,439 views
asked Mar 15, 2013 in Q2A Core by q2apro

I thought of creating another forum which is for just a few people, however, these people speak different languages. To cover 3 languages in 1 forum I would like to add an option to switch languages.

This would require that q2a saves the language ID in the user profile data, and loads the according language file.

Has anyone written a plugin on that?

Will sth like that be implemented in 1.6?

Thanks,
Kai

Q2A version: 1.5.4
commented Mar 19, 2013 by q2apro
More info: In qa-base.php we have:
    $languagecode=qa_opt('site_language');
Here the forum language is taken.

In the recent version of q2a (1.5/1.6.0) it is not implemented.

What might work: Adding after:
    $languagecode=qa_opt('site_language');
something like (pseudo code):
    $languagecode=getUsersLanguage($recentUserID);

3 Answers

0 votes
answered Mar 15, 2013 by Ronlaw
You can set different domains to use the same database. In each of them you use a different language pack. Not the ideal solution but it should work.
commented Mar 17, 2013 by q2apro
This seems too much work. 3 full installations of q2a just to achieve that 3 different language files are called...
commented Mar 18, 2013 by Ronlaw
What I don't understand is what difference it really makes if the content asked and posted will still be in the same language.
commented Mar 19, 2013 by q2apro
Hi Ronlaw, nope, the content will be in 3 languages. English question, english answer. German question, german answer... but you are right, users have got used to it.

I will probably add an extra field for questions "language" and display questions only to the user's language :)
+1 vote
answered Mar 19, 2013 by jatin.soni

 

If you are not so concern about translation quality than you can use google language tool. You can simply embed to your website as a dropdown list and define your language and good to go..

Something like below

<script type="text/javascript">

function googleTranslateElementInit() {

  new google.translate.TranslateElement({pageLanguage: 'en',includedLanguages: 'en,fr', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>
 
Or this
 
<form name="google_tr">
<select class="dropdown" name="example" size="1" onChange="location=this.options[this.selectedIndex].value+'&amp;u='+location.href">
<option value="" selected>Select a language:</option>
</select>
</form>

 

commented Mar 19, 2013 by q2apro
never rely on google services ;) just got a punch in my face losing google reader...
0 votes
answered Jul 10, 2013 by q2apro
edited Jul 10, 2013 by q2apro
...