qTranslate + TwentyTen theme

Having Problems? Need Help? Post here!

qTranslate + TwentyTen theme

Postby deyneko » Fri Sep 23, 2011 1:24 am

Hi All,
Several weeks after installing the QTranslate I have been trying to resolve follow problem
1. There is switching to default language after press "home"
2. There is switching to default language after search something on the site.
3. There is switching to default language after post comment.

Sorry I will be honest... :evil:
I just tired... It seems that switching to default language it is headache of thousands people. And of course I saw lot of topics concerning this problem, but for example I can not even find code in my php pages which they replaced.

Could anyone resolve this problem in TWENTYTEN theme? Please help!
deyneko
 
Posts: 6
Joined: Thu Sep 15, 2011 6:03 pm
Location: Montreal

Re: qTranslate + TwentyTen theme

Postby liew » Fri Sep 23, 2011 10:13 am

1. Add the following code into headers.php on the top (right before "?> <!DOCTYPE html>"),
Code: Select all
add_filter('home_url', 'qtrans_convertURL');

Now you can reference the home link in your template using
Code: Select all
<a href="<?php echo get_bloginfo('home'); ?>" rel="home">My Home Link</a>


3. Add the following into functions.php
Code: Select all
add_action( 'comment_form', 'myCommentsClosing' );

function myCommentsClosing() {
   echo '<input type="hidden" name="redirect_to" value="'. get_permalink() . '" />';
}


Not too sure about part 2 though.
liew
 
Posts: 7
Joined: Thu Aug 25, 2011 3:04 am
Location: Singapore

Re: qTranslate + TwentyTen theme

Postby deyneko » Fri Sep 23, 2011 12:47 pm

Thank you very much! You just saved another user of qTranslate. In spite I like the qTranslate because it has lower "official support" I had thoughts to buy WPML...
Codes you wrote work perfect! :D

But I received another problem - search does work only in default language. When I submit search (on site in widget) in another language (not default) it adds double language tag.
This example searching in French:
http://deyneko.com/fr/fr/?s=Canada Instead http://deyneko.com/fr/?s=Canada
deyneko
 
Posts: 6
Joined: Thu Sep 15, 2011 6:03 pm
Location: Montreal

Re: comment submission redirection problem

Postby bedex78 » Mon Nov 14, 2011 3:33 pm

@liew:

I just tried your solution for the comment submission problem (#3)... while it worked, in that it does not redirect you to the default language, it unfortunately doesn't direct you to the right comment page if you have pagination for your comments, ie. it directs you to the first comment page instead of the last page where the new comment is.

UPDATE:

Actually, the actual code still directs it to the default language. You need to wrap the permalink in qtrans_convertURL(), like so:

Code: Select all
echo '<input type="hidden" name="redirect_to" value="'. qtrans_convertURL(get_permalink()) . '" />';


However, this still doesn't direct you to the last submitted comment when using comment pagination.

Do you know how to fix this?

Cheers!
bedex78
 
Posts: 31
Joined: Mon Oct 04, 2010 9:11 am

[SOLVED] comment submission redirection problem

Postby bedex78 » Wed Nov 16, 2011 1:12 am

I had figured out my own solutions for the comment submission problem, adjusted for my personal use. Just in case it might come in handy for someone else, here's the method that I used:

http://wordpress.stackexchange.com/ques ... 3838#33838
bedex78
 
Posts: 31
Joined: Mon Oct 04, 2010 9:11 am

Re: qTranslate + TwentyTen theme

Postby MitrilGM » Thu Feb 16, 2012 5:10 pm

liew wrote:Add the following code into headers.php on the top (right before "?> <!DOCTYPE html>"),
Code: Select all
add_filter('home_url', 'qtrans_convertURL');


This works prefect to me! Great job !

WP 3.3.1 + TwentyTen theme
MitrilGM
 
Posts: 2
Joined: Thu Feb 16, 2012 4:10 pm


Return to qTranslate Support Forum

Who is online

Users browsing this forum: Google [Bot], Google Adsense [Bot] and 6 guests