Multiple Languages

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

Re: Multiple Languages

Post by happydg »

18 languages.
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

the main idea of languages is to have different descriptions for galleries.

I think the best way to avoid additional DB load is to use easy internationalization

http://smartcj.com/wiki/doku.php?id=new ... zation_i18

this way you don't have to create language slaves at all.

Also there's no problem with redirects and so on as it loads up all languages right from the template.

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

Re: Multiple Languages

Post by happydg »

Yes that could be an idea.

I already have a language template.
The only big problem is for categories ( groups ) translations. It's very important to have categories translated ( the most important thing when you translate multi niches porn sites ) and have <!--CATEGORY_CUSTOM_NAME--> ( ie translated groups) everywhere in the template.


An idea would be to add in languages template something like: IF <!--GROUP_NAME--> = "Lesbians" translation if "FR" = "Lesbiennes" but i don't think it's possible right now.
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Modify an array

$my_keywords['de'] = array(
'most_popular' => 'Populärste',
'order_by_date' => 'Sortiert nach Datum',


'asian' => 'asian_in_de',

and so on
);


and output as

<!--CATEGORY_CUSTOM_NAME--> replace with

$lang['<!--CATEGORY_NAME-->']
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 don't have any slave language anymore. It works but few things aren't working fine. I added at the bottom of language template:

Code: Select all

if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
  $lang = $my_keywords['fr'];
} elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
  $lang = $my_keywords['de'];
} else $lang = $my_keywords['en'];

if ($_GET['set_lng'] and isset($my_keywords[$_GET['set_lng']])) {
  setcookie('force_lng', $_GET['set_lng'], time() + 86400);
  $lang = $my_keywords['en'];
} elseif ($_COOKIE['force_lng'] and isset($my_keywords[$_COOKIE['force_lng']])){
  $lang = $my_keywords[$_COOKIE['force_lng']];
}

if ($_GET['force_lng'] and isset($my_keywords[$_GET['force_lng']])) {
  $lang = $my_keywords[$_GET['force_lng']];
} else $lang = $my_keywords[$_GET['en']];
and htaccess

Code: Select all

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

1) When i go to mydomain.com i would like that it redirects to mydomain.com/fr/. It loads just mydomain.com/ with blank where there are <?=$lang['...']?>. When I used languages slave, it redirected to mydomain.com/fr/ when i went to mydomain.com/. If i go to http://www.domain.com/de/ it works though.

I tried to remove:

Code: Select all

if ($_GET['force_lng'] and isset($my_keywords[$_GET['force_lng']])) {
  $lang = $my_keywords[$_GET['force_lng']];
} else $lang = $my_keywords[$_GET['en']];
From language template but then http://www.domain.com/de/ or http://www.domain.com/?force_lng=de don't work anymore. But http://www.domain.com/ will load in french language ( my browser language ). It's not good for google, i need to have http://www.domain.com/fr/ as french language.

I need to have domain.com redirect to domain.com/lang/ and have domain.com/lang/ working and also domain.com default language working.

PS: In settings - Language selection: i have Auto Switch Language= Yes and Auto Redirect to existing language = http://{DOMAIN}/{LANGUAGE}/{ORIGINAL_REQUEST}
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

1. language settings work for language slaves only
2. what's the point to have redirects if you have the same descriptions at every page ? Google will consider that as duplicate pages (iу the same content with just a few changes in header (category name for example) )

PS you can add redirects based on langiuage in traffic rules - in redirects
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

2) Please check for example: http://bigsex.tv/ It redirects to my language http://bigsex.tv/fr/ and only have categories as text content.

It is 2000 alexa and has 90% search engine traffic.

There are many other sites like this. http://www.largehdtube.com/ from alexz-traffic have all descriptions in the same language but just translate categories and some words in the template.
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

May be ..
Anyway you can setup as many redirects as you want in traffic rules.
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Let' say i add this code at the bottom of languages template:

Code: Select all

if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
  $lang = $my_keywords['fr'];
} elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
  $lang = $my_keywords['de'];
} else $lang = $my_keywords['en'];

if ($_GET['set_lng'] and isset($my_keywords[$_GET['set_lng']])) {
  setcookie('force_lng', $_GET['set_lng'], time() + 86400);
  $lang = $my_keywords['en'];
} elseif ($_COOKIE['force_lng'] and isset($my_keywords[$_COOKIE['force_lng']])){
  $lang = $my_keywords[$_COOKIE['force_lng']];
}
And create traffic rules for language redirection:

If it redirects to http://www.domain.com/de/ for a German user: This page will still be in french.

If i delete this code:

Code: Select all

if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
  $lang = $my_keywords['fr'];
} elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
  $lang = $my_keywords['de'];
} else $lang = $my_keywords['en'];
There will be blank where there are <?=$lang['...']?>.
Last edited by happydg on Thu Aug 25, 2016 10:55 am, edited 1 time in total.
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

You can use $_GET['force_lng'] instead of $_GET['set_lng']
Don't forget to run script update
Post Reply