Page 6 of 7

Re: Multiple Languages

Posted: Mon Aug 29, 2016 12:11 pm
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?

Re: Multiple Languages

Posted: Mon Aug 29, 2016 12:35 pm
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.

Re: Multiple Languages

Posted: Mon Aug 29, 2016 2:08 pm
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?

Re: Multiple Languages

Posted: Mon Aug 29, 2016 4:12 pm
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%.

Re: Multiple Languages

Posted: Mon Aug 29, 2016 9:51 pm
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?

Re: Multiple Languages

Posted: Tue Aug 30, 2016 5:15 am
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

Re: Multiple Languages

Posted: Tue Aug 30, 2016 9:56 am
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.

Re: Multiple Languages

Posted: Tue Aug 30, 2016 10:29 am
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 ?

Re: Multiple Languages

Posted: Tue Aug 30, 2016 12:03 pm
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.

Re: Multiple Languages

Posted: Tue Aug 30, 2016 12:40 pm
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 ?