Author Topic: Multilanguage  (Read 3778 times)

Offline rumen

  • Posts: 399
Multilanguage
« 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?

Offline dbs

  • Betatester
  • **
  • Posts: 8039
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Multilanguage
« Reply #1 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).

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #2 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');?>]" />


Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #3 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

Offline dbs

  • Betatester
  • **
  • Posts: 8039
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Multilanguage
« Reply #4 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);

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #5 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.

Offline dbs

  • Betatester
  • **
  • Posts: 8039
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Multilanguage
« Reply #6 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.

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #7 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

Offline dbs

  • Betatester
  • **
  • Posts: 8039
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Multilanguage
« Reply #8 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 -->
*/

Offline crnogorac081

  • Posts: 1912
  • Gender: Male
Re: Multilanguage
« Reply #9 on: February 26, 2018, 09:31:54 AM »
when i click EN flag i get error and infinite _GET parameter &lng=En..
no bb in signature

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #10 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) ? 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 ->




 

Wer nicht will, findet Gründe, wer will, findet Wege.

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #11 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.

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #12 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
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #13 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.

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #14 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
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #15 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. 

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #16 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
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #17 on: February 26, 2018, 09:41:53 PM »
Sure, here you are mate:






Offline hgs

  • Betatester
  • **
  • Posts: 1119
    • EFG MG
Re: Multilanguage
« Reply #18 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
LG Harald

"Fange nie an, aufzuhören - höre nie auf, anzufangen." Marcus Tullius Cicero (106-43 v.Chr.)

Offline rumen

  • Posts: 399
Re: Multilanguage
« Reply #19 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 ....

Offline crnogorac081

  • Posts: 1912
  • Gender: Male
Re: Multilanguage
« Reply #20 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
no bb in signature

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #21 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



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
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #22 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??
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #23 on: February 28, 2018, 04:52:49 PM »
pls set (for a test) the page Влагодаря to visibility = none or give at a parent = BG
Wer nicht will, findet Gründe, wer will, findet Wege.

Offline jacobi22

  • Posts: 5879
  • Gender: Male
  • Support also via PM or EMail
    • Jacobi22
Re: Multilanguage
« Reply #24 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)
Wer nicht will, findet Gründe, wer will, findet Wege.

 

postern-length