Multiple Languages

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

Re: Multiple Languages

Post by happydg »

Do you mean i have to keep Location: http://your_domain/fr/ in common.php

but change RewriteRule ^([^/]{2})/(.*)$ $2?force_lng=$1&%{QUERY_STRING} [L] in htaccess?
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

You should have URLs like

http://www.domain.com/fr/category/lesbian/


100% of all redirects\language stuff is in 3 places

1. .htaccess
2. common.php
3. language template

feel free to edit it, just make a backup.
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 found the solution:

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   }

}
But there is another problem. I added all categories translation to languages template. But there are a lot of translations ( 690 categories x 18 languages ).

I notice if the language template is having more than about 2425 lines i get this error when i go to any page:

Parse error: syntax error, unexpected '<' in /home/user/domain.com/www/scj/tube/index.php(0) : eval()'d code on line 2435

The problem doesn't come from a syntax error. The problem is that it has more than 2425 lines in language template.

How to fix this?
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

Parse error: syntax error, nexpected '<' in /home/user/domain.com/www/scj/tube/index.php(0) : eval()'d code on line 2435

The problem doesn't come from a syntax error. The problem is that it has more than 2425 lines in language template.
It does.
100%.
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Ok i understand what the problem is:

When you go to Rotation - Templates and edit languages template:

If you copy/paste more than 2500 lines ( or something like that) and click on save it will save just the first 2500 lines, not more.

So the template get cut at some line, i can't save the whole tempate.

How to save a template with more more lines?
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

There's only 1 limit - the size of the field - 65,535 bytes

You can make it bigger

ALTER TABLE `rot_pages` CHANGE `template` `template` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Multiple Languages

Post by happydg »

Hello,

The problem is the language template is very big now and if I understand right it loads each time a page load. Would this idead work to reduce the load time?

I include in each template:

If HTTP_ACCEPT_LANGUAGE = fr then <!--INCLUDE_TEMPLATE_languageFR--> elseif HTTP_ACCEPT_LANGUAGE = de then <!--INCLUDE_TEMPLATE_languageDE--> etc...

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

Re: Multiple Languages

Post by admin »

You have 10-15 languages
let's say you have 100 categories and 50 elements of design
that's 15*150 = 2250 maximum

So i've create a php file with 4000 lines
Execution time - 0.001 sec

Where do you see that load ?
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 have 700 categories with 18 languages, but i could compress the file so it's doing only 300kb.

The only problem is to have <category order=alphabet> translations order in alphabet.
admin
Site Admin
Posts: 37994
Joined: Wed Sep 10, 2008 11:43 am

Re: Multiple Languages

Post by admin »

You can save it as 18 files (parts) and include necessary file based on current language.

Now you have all the category names in your php code, right ?
Don't forget to run script update
Post Reply