Invalid Token error after install JoomFish with GTranslate

Popular automatic website translation tool

Invalid Token error after install JoomFish with GTranslate

Postby sky » Sat Nov 05, 2011 3:24 pm

My site was running GTranslate Pro with no problem before. today, I installed latest ver of Joomfish, then my jomsocial login module always show "Invalid token" error when trying to login. I have done a lot of testing to find out why, and finally found that this is caused by the Gtranslate code in the .htaccess below. when I remove them, everything is ok. why's that? what's wrong? I am running 3 languages: Traditional Chinese (default), Simplified Chinese (auto translated by Gtranslate pro), and English (manually translated with Joomfish)

RewriteEngine On

gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 [L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1 [L,QSA]

RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.mysite.com/$1 [L,R]
ErrorDocument 404 /
sky
 
Posts: 13
Joined: Sun Apr 03, 2011 5:36 pm

Re: Invalid Token error after install JoomFish with GTransla

Postby Edvard » Sun Nov 06, 2011 9:05 pm

If you disable JoomFish plugins it works as expected or you still see the invalid token error?
Regards,

Edvard Ananyan - GTranslate Team

Please post a review at the Joomla Extensions Directory. It is very important for us!
Edvard
Site Admin
 
Posts: 3316
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Invalid Token error after install JoomFish with GTransla

Postby sky » Mon Nov 07, 2011 6:05 am

my site will be down and I will get the below error if I disabled "System - Jfrouter" plugin.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
sky
 
Posts: 13
Joined: Sun Apr 03, 2011 5:36 pm

Re: Invalid Token error after install JoomFish with GTransla

Postby Edvard » Mon Nov 07, 2011 1:42 pm

That is not normal. After you disable it the system should continue to work as expected. Can you try to use a different browser after disabling it? Or clear cookies for your domain name after you disable it.
Regards,

Edvard Ananyan - GTranslate Team

Please post a review at the Joomla Extensions Directory. It is very important for us!
Edvard
Site Admin
 
Posts: 3316
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Invalid Token error after install JoomFish with GTransla

Postby sky » Mon Nov 07, 2011 2:53 pm

Yes, confirm that disable "System - Jfrouter" plugin will cause the error.

I just upgrade to latest ver of GTranslate pro, then the invalid token error no longer shows.
However, after installing the latest ver, Joomfish language (English) no longer works. If I remove these lines from .htaccess, English will be working again:

# gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 [L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1 [L,QSA]

RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.mysite/$1 [L,R]
ErrorDocument 404 /

Here is my joomfish plugin setting:
http://screencast.com/t/T1bZSThqH8GS

I see your mention the below in another post, but I don't know how exactly to do it. Can you give me example?

If you want to use both in parallel you need to install GTranslate Pro for general websites which is included in the product package. Then in .htaccess file you need to add only those languages which should be handled by GTranslate. Your webmaster should be able to make appropriate changes in the .htaccess file.
sky
 
Posts: 13
Joined: Sun Apr 03, 2011 5:36 pm

Re: Invalid Token error after install JoomFish with GTransla

Postby Edvard » Tue Nov 08, 2011 3:39 pm

The settings are OK, you will need to change cn to zh-CN.

Then you need to use this rewrite rules instead:
Code: Select all
# gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L]
RewriteCond %{REQUEST_URI} !^/en
RewriteCond %{REQUEST_URI} !^/zh-CN
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 [L,QSA]
RewriteCond %{REQUEST_URI} !^/en
RewriteCond %{REQUEST_URI} !^/zh-CN
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1 [L,QSA]
Regards,

Edvard Ananyan - GTranslate Team

Please post a review at the Joomla Extensions Directory. It is very important for us!
Edvard
Site Admin
 
Posts: 3316
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Invalid Token error after install JoomFish with GTransla

Postby sky » Wed Nov 09, 2011 6:44 am

My default language is: zh-TW, zh-CN is translated via GTranslate, and en is via joomfish.
Should it be like this?

# gtranslate config
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L]
RewriteCond %{REQUEST_URI} !^/en
RewriteCond %{REQUEST_URI} !^/zh-TW

RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&url=$2 [L,QSA]
RewriteCond %{REQUEST_URI} !^/en
RewriteCond %{REQUEST_URI} !^/zh-TW

RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1 [L,QSA]

Can you explain what the red lines mean? If I want to add one more joomfish translated language fr, I need to add one more line?
RewriteCond %{REQUEST_URI} !^/fr

on the other hand, some pages only partially translated by GTranslate pro, why is that?
sky
 
Posts: 13
Joined: Sun Apr 03, 2011 5:36 pm

Re: Invalid Token error after install JoomFish with GTransla

Postby Edvard » Wed Nov 09, 2011 6:18 pm

The red lines exclude the languages from being handled by GTranslate. Yes, it is correct, if you add that line you will exclude also French from GTranslate.

If you see a partially translated page try to add ?force_translation=1 in the end of the URL and it will forcefully translate the full page. If you have a lot of partially translated pages. You can replace lang=$1 with lang=$1&force_translation=1 in the .htaccess rewrite rules.
Regards,

Edvard Ananyan - GTranslate Team

Please post a review at the Joomla Extensions Directory. It is very important for us!
Edvard
Site Admin
 
Posts: 3316
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia

Re: Invalid Token error after install JoomFish with GTransla

Postby sky » Thu Nov 10, 2011 9:24 am

ok, now all translations are working, except one issue:

my default language is zh-TW, but I am not adding zh-TW in my default language sef url:
www.mysite.com/page1/

but when I tried to switch language from any languages to the default language zh-TW by clicking the GTranslate flags, the default language url will have the zh-TW added, which will show page not found error:

www.mysite.com/ zh-TW/page1/

How to set GTranslate not adding the zh-TW in url when switching languages?
sky
 
Posts: 13
Joined: Sun Apr 03, 2011 5:36 pm

Re: Invalid Token error after install JoomFish with GTransla

Postby Edvard » Thu Nov 10, 2011 4:58 pm

If you have set the default language in gtranslate/config.php file to zh-TW then you can remove this line: RewriteCond %{REQUEST_URI} !^/zh-TW which will fix the issue.
Regards,

Edvard Ananyan - GTranslate Team

Please post a review at the Joomla Extensions Directory. It is very important for us!
Edvard
Site Admin
 
Posts: 3316
Joined: Mon Jun 28, 2010 1:54 pm
Location: Yerevan, Armenia


  • Related Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests

2GLux