Multiple Languages

Post Reply
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Multiple Languages

Post by happydg »

Hello,

Let's say i have a multi niches site with multiple languages and with language auto redirect on.

I go to mydomain.com which redirects to mydomain.com/fr/. Then i click on mydomain.com/ru/ because i want to site in russian.

I have custom categories links setup in common.php and htaccess on the main page for example: /?k=Shemale&y=4:2:430 which redirect to /category/Shemale/.

The problem is if change language to mydomain.com/ru/ and click on mydomain.com/?k=Shemale&y=4:2:430 it goes to mydomain.com/fr/category/Shemale/ instead of mydomain.com/ru/category/Shemale/

1) How to retrieve the current language of the page So i could put this link: /?k=Shemale&y=4:2:430&language=currentlanguage and create a custom link language in common.php ?

Thank you.
admin
Site Admin
Posts: 37238
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

What build do you use ?
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Latest Build 201603221213 (Lastest build: 201603221213
admin
Site Admin
Posts: 37238
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Sorry for the late answer.
The easiest way is to add <?=$_GET['force_lng']?> variable to your links
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Where should i add this code in a link exactly?
admin
Site Admin
Posts: 37238
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Depends on your rewrites

for example

http://domain/<?=$_GET['force_lng']?>/gallery/<!--GALLERY_SLUG-->/

anyway w\o rewrites it wshould be

out.php?url=content&slug=...&force_lng=... and so on
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

I added:

Code: Select all

if (isset($_GET['l'])) $_GET['force_lng'] = $_GET['l'];
In common.php, so my link is

Code: Select all

/test/?k=<!--CATEGORY_NAME-->&l=<?=$_GET['force_lng']?>...
but it still redirects to french version when i'm on spanish page.

For example when i'm on http://www.domain.com/es/ and click on http://www.domain.com/test/?k=Babe&l=es it goes to http://www.domain.com/fr/category/Babe/ instead of http://www.domain.com/es/category/Babe/

I have in htaccess:

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]{2})/(.*)$ $2?force_lng=$1&%{QUERY_STRING} [L]

RewriteRule ^test/$ /scj/cgi/out.php?url=content&p=100&%{QUERY_STRING} [L]

What should i add in htaccess to fix it?

Thank you.
admin
Site Admin
Posts: 37238
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Does it work as it suppose to w\o rewrites ?
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

It works without rewrites:

http://domain.com/scj/cgi/out.php?url=c ... _name=babe

Goes to Spanish version, i can check this by inserting <?=$_GET['force_lng']?> somewhere in content_list.

But if i go to http://www.domain.com/es/category/babe/ directly, the <?=$_GET['force_lng']?> in the content_list will output "fr" and not "es".

Here are my category url rewrites:

Code: Select all

RewriteRule ^category/([^/]+)/$ /scj/cgi/out.php?link=images/%{QUERY_STRING}&url=content&p=100&skip_to_cookie=true&skip_sell=true&group_name=$1&order=ctr [L]
RewriteRule ^category/([^/]+)/$ /scj/tube/index.php?group_name=$1 [L]
RewriteRule ^category/([^/]+)/([^/]+)/([^/]+)/$ /scj/cgi/out.php?link=images/%{QUERY_STRING}&url=content&p=100&skip_to_cookie=true&skip_sell=true&group_name=$1&order=$2&page=$3 [L]
RewriteCond %{QUERY_STRING} ^(.+)$ 
RewriteRule ^category/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /scj/cgi/out.php?link=images/%{QUERY_STRING}&url=content&p=100&skip_to_cookie=true&skip_sell=true&group_id=$1&order=$3&page=$4 [L]
RewriteRule ^category/([^/]+)/([^/]+)/([^/]+)/([^/]+)/$ /scj/tube/index.php?group_id=$1&order=$3&page=$4 [L]
admin
Site Admin
Posts: 37238
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Then there's a mistake in rewrites
Double сheck it

You can add

print_r($_GET);

into common.php to see what variables actually gets the script.
Don't forget to run script update
Post Reply