WebsiteBaker Community Forum

WebsiteBaker Support (2.11.x) => General Help & Support => Topic started by: rumen on February 21, 2018, 11:36:28 PM

Title: Multilanguage
Post by: rumen on February 21, 2018, 11:36:28 PM
I saw there is no need to install multilingual module in 2.11. But - how it works? Any docs? Idea? Hint?
Title: Re: Multilanguage
Post by: dbs on February 22, 2018, 12:23:49 AM
Take a look into the defaultTemplate.
The menue structure for multilingual is the same like before.
EN,DE,NL... now can also be normal pages (not only menue_link).
Title: Re: Multilanguage
Post by: rumen on February 22, 2018, 10:38:44 AM
Maybe I do something wrong, but when I put this code the page crashes.

Code: [Select]
<?php
// if function LangPadeId doesn't exists, you have to upgrade WBLingual Switcher Add-on to latest version'
if (!function_exists('LangPadeId')) {function LangPadeId(){return PAGE_ID;}}
// to show flags in frontend
    
$iMultiLang 0;$sMultiLang ''; if (function_exists('language_menu')){$sMultiLang language_menu('png',false); $iMultiLang intval(!empty($sMultiLang) ? 0);}
    if (
function_exists('LangPadeId')&&$iMultiLang) {
?>


    <link rel="alternate" hreflang="x-default" href="[wblink<?php echo LangPadeId($sPageLang);?>]" />
    <link rel="alternate" hreflang="de" href="[wblink<?php echo LangPadeId('DE');?>]" />
    <link rel="alternate" hreflang="en" href="[wblink<?php echo LangPadeId('EN');?>]" />

Title: Re: Multilanguage
Post by: rumen on February 22, 2018, 10:41:50 AM
When I call the EN page from back end I get error:

Code: [Select]
The page isn’t redirecting properly

Cliqz has detected that the server is redirecting the request for this address in a way that will never complete.

    This problem can sometimes be caused by disabling or refusing to accept cookies.

And in the address of the browser I see

Code: [Select]
http://zapryanov.faith/pages/home.php?lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN


And it should be only:

Code: [Select]
http://zapryanov.faith/pages/home.php?lang=EN
Title: Re: Multilanguage
Post by: dbs on February 22, 2018, 10:53:37 AM
Is this the right DefaultTemplate?
In my 2.11 i see in line 42,43
Code: [Select]
$sPageLang    = strtolower(isset($wb->page) || ($wb instanceof frontend) ? $wb->page['language'] : 'EN');
$iPageId = (defined('PAGE_ID') ? PAGE_ID : 0);
Title: Re: Multilanguage
Post by: rumen on February 22, 2018, 01:17:55 PM
No, it is my template which is still under development .

This is (attached) without images and fonts, because otherwise the file is big and WB forum reject it.
Title: Re: Multilanguage
Post by: dbs on February 22, 2018, 02:51:28 PM
Can't see something of multilanguage in your template.
I can't do your work. :wink:
Please look into the DefaultTemplate of WB 2.11. There are some places with multilingual.
First try something.
Title: Re: Multilanguage
Post by: rumen on February 25, 2018, 11:12:40 PM
You didn't understand me dbs, when I put the codes from the default template the page crash (that's why I removed them and you didn't saw them) ... the menu disappear and only one word stay somewhere behind the logo ... and the EN language doesn't work properly.

Look here now: http://zapryanov.faith/pages/nachalo.php
Title: Re: Multilanguage
Post by: dbs on February 25, 2018, 11:32:44 PM
Hi, i see no WBLingual js. You have before end body this?:
Code: [Select]
<?php  register_frontend_modfiles_body(); ?>
This loads the frontend_body.js of WBLingual. Maybe it helps.

This part in your index can be removed:
Code: [Select]
/*       
<!-- show_menu2 -->
*/
Title: Re: Multilanguage
Post by: crnogorac081 on February 26, 2018, 09:31:54 AM
when i click EN flag i get error and infinite _GET parameter &lng=En..
Title: Re: Multilanguage
Post by: Gast on February 26, 2018, 12:09:25 PM
start at the begin, step by step

#1 - i start with a fresh wb 2.11, all filters activated, but not OpF, JQueryUI, these are the defaults after a new install

#2 - add some pages, BG and EN with type "menu-link", Home-BG and Home-EN with type "wysiwyg" (only to try it). Be sure, that every page has the correct language. Every Subpage (Child) of an Mainpage like BG or EN must have the language from this Parent-Page. it's recommended, to start with the main language and adding there all needed subpages / child for this tree-part

Example-tree here -> https://i.gyazo.com/cc254a6f014b0b44d3911e0e3e282776.png

#3 - the page code
if you have the exact page structure in all language-tree's (here under BG or under EN), WB set the pagescodes automatically, if you click in one page on the pagesettings on the link "pagecode". it is very important, that every page has the correct page code. otherwhise, you get a error, when you switch the pages or you get a redirect to the main-page.

#4 - the code for the index.php
i add your template to my installation (in a fresh WB 2.11). The code is a exact copy from the example in DefaultTemplate (WB-Package) - it works without problems and i can switch the languages from page to page

1. your code to prevent this file for directly access (outside from WB)
if (!defined('WB_PATH')) die(header('Location: ../../index.php'));
Redirect's to a higher level with a relative path like this example (with ../) is a security risk. its possible, to manipulate links like this. it is possible, to come with a manipulated link out of this wb-installation and directly into the server document root or more

WB use since WB 2.10 an prevention like this without a redirect
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if (!defined('SYSTEM_RUN')) {header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); echo '404 File not found'; flush(); exit;}
/* -------------------------------------------------------- */

2. - read the actual language of the selected page

$sPageLang    = strtolower(isset($wb->page) || ($wb instanceof frontend) ? $wb->page['language'] : 'EN');
means in simple words: if it's not possible to read the page language, set it to EN (english - if you dont have a english page in this project, change the code to your main language - in your case maybe the favorite Language BG. Write this Language-code in upper Letter. if you not sure about the correct language code, take a look into the favorite language file in folder /languages

3. read the actual page-id
$iPageId = (defined('PAGE_ID') ? PAGE_ID : 0);
it's important to use the the flag menu

4. the flag menu - controler
$iMultiLang = 0;$sMultiLang = ''; if (function_exists('language_menu')){$sMultiLang = language_menu('png',false); $iMultiLang = intval(!empty($sMultiLang) ? 1 : 0);}
check, if it possible to use the function, result set this switch to true or false
language_menu('png',false) - possible file type's gif, png, svg

5. build href-lang links (optional)
the follow code is only needed, if you want the href-links. if you use this, be sure, that this code in placed behind the open <head> and the closing </head>

Code: [Select]
if (!function_exists('LangPadeId')) {function LangPadeId(){return $iPageId;}}
if (function_exists('LangPadeId')&&$iMultiLang) {
?>
<!--
    <link rel="alternate" hreflang="x-default" href="[wblink<?php echo LangPadeId($sPageLang);?>]" />
    <link rel="alternate" hreflang="de" href="[wblink<?php echo LangPadeId('DE');?>]" />
    <link rel="alternate" hreflang="en" href="[wblink<?php echo LangPadeId('EN');?>]" />
-->
<?php
    
}
?>

#6 - the flag menu - somewhere between open <body> and closing </body>
the div-block around is only a example, important is the php-code there
<div id="lang" style="height: 2.925em;">
            <?php if(trim($sMultiLang)!=''){ ?>
            <?php echo $sMultiLang; ?>
            <?php } ?>
        </div>

#7 - working without filters
if your project dont use any filters, specially without FrontendCSS, FrontendJS, RegisterModFiles, SnippetJS, you have to include the file /modules/WbLingual/include.php manually. (and also every other include file from other snippets)

Quote
You didn't understand me dbs, when I put the codes from the default template the page crash (that's why I removed them and you didn't saw them) ... the menu disappear and only one word stay somewhere behind the logo ... and the EN language doesn't work properly.

for example - if i remove the engine of your car, you cannot drive. And if you add the engine again and it doesnt run and because ot this, you remove it again, the car will not drive - you understand?   :wink:

Step #1 - #4 are only some hints, very important are #2 and #3
from the points 1 - 7, you can remove No.5, if not needed, but all other things are neccessary. every little step is important, it's like a car - if i forgot to add the fuel, the car will not drive, if i forget to add the battery, the car will not drive e.g.

P.S. go to your advanced wb-settings - server settings, set PHP-Errors to production or development for the time, where you work on it, so you get some more informations about possible errors in your error log

if you get more problem's, give us also the used PHP-version - see info-Window here -> (https://i.gyazo.com/1ee55f70b6cb0ae15dfdb6e863b14917.png)




 

Title: Re: Multilanguage
Post by: rumen on February 26, 2018, 02:12:06 PM
I think the problem comes from the previous installation. I installed 2.10 with multi language module. After that I decided to check 2.11 .... I upgraded and the multi language crashed. And all codes from the new default template either crash the template as a whole or crash the menu or there is no any effect  .... OK never mind it is not an issue. I can try to make a new copy of 2.10 at the local disk and install 2.10 with the old language method.
Title: Re: Multilanguage
Post by: Gast on February 26, 2018, 02:42:10 PM
normalize, the upgrade of the WbLingual-Module in WB 2.11.0 delete the old mod-multilingual-Module in /modules/mod_multilingual

be carefull: wb 2.10.x use a different method to call the multi-lingual menu / flag menu, dont use a mix between files and function call
Title: Re: Multilanguage
Post by: rumen on February 26, 2018, 04:21:21 PM
OK

1. Easy Multi language - uninstalled
2. The WB upgraded - as a whole ...
3. Instructions from the Readme.txt from Module: WebsiteBaker Lingual Switcher Add-on 1.0.0-dev.4 - applied

And again nothing and too many things crashed.   

Don't worry and don't loose your time. I will make the page again with 2.10 and everything will work.
Title: Re: Multilanguage
Post by: Gast on February 26, 2018, 04:38:54 PM
i did'nt understand, why you mix everything and not wondering, that you have problems now

1. Easy Multi language - uninstalled - rewrite the pages database table and destroy the page structure, specially for the page-code-field, only possible to repair with a new install of WB
Module is deprecated since 8 years!

2. WebsiteBaker Lingual Switcher Add-on 1.0.0-dev.4 -  why do you think the RC2 and WB 2.11 stable contain a new module version?

it make's no sense to write here more and more instructions, if nobody read it  :roll: :roll:
follow my instructions in the top in a WB 2.11 and everything works
Title: Re: Multilanguage
Post by: rumen on February 26, 2018, 07:26:42 PM
OK I have followed all your instructions (At least I think). Now the menu doesn't crash, the flags are there and the Bulgarian works, the EN not (for now).

All the tree is done as per instructions. 
Title: Re: Multilanguage
Post by: Gast on February 26, 2018, 08:10:52 PM
do you have the english tree finish and set all languages correct??

if you use menu-link as type for the EN-Page, have you set the redirect to a english sub-page?
i think, thats the problem here
maybe, a screenshot from the engl. Tree can help
Title: Re: Multilanguage
Post by: rumen on February 26, 2018, 09:41:53 PM
Sure, here you are mate:

(https://preview.ibb.co/iS6V2c/EN_menu1.png) (https://ibb.co/cuaONc)

(https://preview.ibb.co/e3kONc/EN_menu2.png) (https://ibb.co/cVAq2c)

(https://preview.ibb.co/hEk7hc/EN_menu3.png) (https://ibb.co/fYSbax)
Title: Re: Multilanguage
Post by: hgs on February 27, 2018, 08:26:12 AM
Hello rumen
Your pictures show that you still do not work with the stable version of WebsiteBaker. How should the professionals help you?
Here is the link to the stable version:
https://addon.WebsiteBaker.org/pages/en/browse-add-ons.php?id=04725264
Title: Re: Multilanguage
Post by: rumen on February 28, 2018, 01:12:01 PM
There was no yet stable ver. at hat time. OK if this is the problem, just upgraded to stable 2.11 ....
Title: Re: Multilanguage
Post by: crnogorac081 on February 28, 2018, 03:11:29 PM
I see again problem with language switcher

Code: [Select]
http://zapryanov.faith/pages/en.php?lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN
Title: Re: Multilanguage
Post by: Gast on February 28, 2018, 04:35:45 PM
I see again problem with language switcher

Code: [Select]
http://zapryanov.faith/pages/en.php?lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN&lang=EN

only, if there are no other conditions. result is here an endless loop, that stop's, if he come's to the limit for max_execution_time (default:30sec)

pls give us (or me via PM) the settings -> advanced settings for general settings like this part here

(https://i.gyazo.com/052a96105f933406bb3ceff713685bb8.png)

Problem is: everybody use with WB 2.11 the same software and it works on every other place with a multilingual website  :roll: - so not sure, that the problem is inside of the WBLingual-module
Title: Re: Multilanguage
Post by: Gast on February 28, 2018, 04:46:10 PM
another question:

i see in your screenshots the languages BG and EN as second language. What is the language setting in your profile and in WB-Settings -> Default Settings??
Title: Re: Multilanguage
Post by: Gast on February 28, 2018, 04:52:49 PM
pls set (for a test) the page Влагодаря to visibility = none or give at a parent = BG
Title: Re: Multilanguage
Post by: Gast on February 28, 2018, 06:07:25 PM
pls check also the page code settings for all pages, looks a little bit tricky...   :roll:

if i have a new, clear system, every thing works. i add at first the main language and all pages there, click on the last main language page in the page settings on the link "page-code" and the system set the page code's for the main language automatically and for the new added pages to 0 (zero) and i change then for every new page the page code to a target on the main page - that works for me
but sometime's it's not possible for me, to select a new pagecode in the page-code-field, i dont know, why. maybe, if i have two pages with the same page-code, it looks, that the system choose then an random page  as pagecode  :-o :-o

so i start at the begin, i click again on the pagecode-link and set all page-code's for the other languages new  :oops: :oops:

but all this has nothing to do with the broken redirect like your link, for me only possible, if the pagecode for the EN.php is the own page and not the target BG.php (from your main page)
Title: Re: Multilanguage
Post by: rumen on March 01, 2018, 02:55:56 PM
All done as per instructions above - here is the screenshot with the main language and the other options:

(https://preview.ibb.co/kAvdtH/multilanguage.png) (https://ibb.co/bYw7nc)
Title: Re: Multilanguage
Post by: rumen on March 01, 2018, 02:59:23 PM
Also noticed that the EN (and all sub pages) - page code is empty and also I can't choose any connection with EN for page code - there are only BG available.

(https://preview.ibb.co/bZGnLx/pagecode.png) (https://ibb.co/g4KUYH)
Title: Re: Multilanguage
Post by: rumen on March 01, 2018, 03:02:21 PM
pls set (for a test) the page Влагодаря to visibility = none or give at a parent = BG

After I moved the page to parent BG and made it visible I got the same problem as it is in the EN

Code: [Select]
http://zapryanov.faith/pages/bg/nachalo.php?lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG&lang=BG
Check now the site (http://zapryanov.faith).
Title: Re: Multilanguage
Post by: dbs on March 01, 2018, 04:38:25 PM
At the moment it looks fine, without problems.
What have you done?
Title: Re: Multilanguage
Post by: Gast on March 01, 2018, 04:39:31 PM
looks, that it was a problem inside of the WBLingual-Module (upgrade the page_code-field) or the redirect, if you change the page-language in the project
Rumen was one of the first testers and it works now

we test it a little bit more under different condition's, before we publish a official fix for that   :oops:
if somebody has the same problem and need a fast help, here the download of this fix ->
https://wiki.WebsiteBaker.org/doku.php/downloads
or
https://addon.WebsiteBaker.org/pages/en/browse-add-ons.php?download=00032474
Title: Re: Multilanguage
Post by: rumen on March 02, 2018, 08:19:49 AM
Thanks to Jacobi22 my Personal web CV (http://zapryanov.faith/pages/en/home.php) now looks fine and works well. I will need it very soon. Maybe today  :-D  Thought I will need it in May, but things changes with hours sometimes, so it was ready just in time!

Thanks mate, thanks again!
Title: Re: Multilanguage
Post by: crnogorac081 on March 02, 2018, 08:50:50 AM
Hi rumen,

since site is multilingual, I would suggest to flag menu be visible on all pages. for example on page http://zapryanov.faith/templates/cv_bg/,  flag menu is not visible
Title: Re: Multilanguage
Post by: Gast on March 02, 2018, 08:56:13 AM
 http://zapryanov.faith/templates/cv_bg/ - this is not the WB-Page, is it the preview for the base template and run's outside from the WB-System   :wink:
Title: Re: Multilanguage
Post by: rumen on March 05, 2018, 02:06:43 AM
Hi rumen,

since site is multilingual, I would suggest to flag menu be visible on all pages. for example on page http://zapryanov.faith/templates/cv_bg/,  flag menu is not visible

This is another template outsite the WB (external template - one pager) and is connected to the menu of the WB with "Menu Link" only. That's why there is only one button "Back to site" - mean to back to the WB site. I thought is there a way to integrate that in the other template, but I  couldn't find such.

But it is works in both languages from the menu. The english one: http://zapryanov.faith/templates/cv_en/
Title: Re: Multilanguage
Post by: evaki on March 09, 2018, 05:36:28 PM
Check "Internationalizatio n" by W3C
https://validator.w3.org/i18n-checker/

MfG. Evaki
Title: Re: Multilanguage
Post by: rumen on March 09, 2018, 07:04:33 PM
Thanks a lot Evaki!