Elxis CMS Forum

Support => General => Topic started by: xmanhattan on February 18, 2017, 11:45:06

Title: multilingual sites menus and content
Post by: xmanhattan on February 18, 2017, 11:45:06
Hello all,

I have added a content page in English to a site that uses English and Greek but there will not be a Greek version of the content page.

A separate category was created for the content pages that will be added.
After creating an English menu item for the category, the menu item is displayed on the English and also the Greek menu but in English.

How can I prevent the menu item from displaying on the Greek side?
Title: Re: multilingual sites menus and content
Post by: datahell on February 18, 2017, 18:52:02
Elxis multilingual content is based on translation items. All items are available in all languages regardless if you have added translations for them or not.
Title: Re: multilingual sites menus and content
Post by: xmanhattan on February 19, 2017, 14:02:43
Hello Datahell,

So I have to ask, why an empty (second language description) would not work to prevent this?
Title: Re: multilingual sites menus and content
Post by: datahell on February 19, 2017, 22:02:21
Our experience says that the translations system (Elxis 4.x) is easier, faster and problems free in creating multilingual sites than the language specific site structure of the 200x.x generation.

Lets say you have a site available in 4 languages.

In Elxis 200x.x you had to create 4 different articles and assign them in each language separately. Then you had to create 4 different menu items each for each language version of the article. Most people did huge mistakes there. If you publish a new language you have to edit all of your content and add new items (articles/menus/etc) for the new language.

In Elxis 4.x you create a single article. You can translate individual parts of the article in any of the rest available languages (eg only the title and the subtitle). You also need to create a single menu item, translations to other languages is optional. If you publish a new language all of your content is automatically available in the new language. You can any time translate individual parts of your content in the new language.

The Elxis 4.x multi-language system improves productivity, is easier to use and eliminates the risk of wrong settings.

Your "problem" can be solved in many ways, like with a custom menu module, by loading different modules in your template based on the current language, by loading different templates depending on the language, etc.

Different module positions depending on the language
Create 2 menu modules, one for language A and one for language B with differences in menu items. For easy of use place them in different template positions. In template's index.php file load the corresponding template position based on the current language.

if (eFactory::getLang()->currentLang() == 'el') {
      $eDoc->modules('menugreek', 'none');
} else {
     $eDoc->modules('menu', 'none');
}

Different template depending on the language
In template's index.php file type something like this:

if (eFactory::getLang()->currentLang() == 'el') {
      include('greek.php');
} else {
     include('english.php');
}

Move all index.php functionality to files greek.php and english.php. There you can fully customize the site depending on the current language.
Title: Re: multilingual sites menus and content
Post by: xmanhattan on February 20, 2017, 10:40:58
Okay, fantastic way to do that!
Title: Re: multilingual sites menus and content
Post by: xmanhattan on March 08, 2017, 17:14:48
Hello datahell,

Sorry to bring this up again but after trying to implement separate menus for the Greek, I have not been able to make it work.

My objective is to be able to have some categories and content that are not applicable to both languages to be able to be displayed according to the language because content is not always preferred for both languages.
This is especially true for my website but also for others.

Based on the 2 options that you noted, I chose to use the first that you mentioned.

The following is what I did while testing on my local Debian linux server.

Elxis information Version 4.5 Typhon
Changes that I made to Templates Flex index.php file:

Code: [Select]
<nav class="flex_menu">
<?php 
// $eDoc->modules('menu', 'none');

if (eFactory::getLang()->currentLang() == 'el') {
  $eDoc->modules('user4');
} else {
 $eDoc->modules('user3''none');
}

?>

<div class="clear"></div>
</nav>


Changes that I made through admin.
Using the MENU MANAGER, I created 2 new menus which created the following modules.
      
Created modules for menus:
Module      maingreekmenu
Position   user3
Ordering   1
Collection   maingreekmenu
Orientation   vertical

Module Assignment
- maingreekmenu -
Home
Contact

The maingreekmenu appears in the same position as the English main menu but

Created modules for menus:
Module      topgreekmenu
Position   user4
Ordering   1
Collection   topgreekmenu
Orientation   horizontal

Module Assignment
- topgreekmenu -
Home
Contact

The Module Assignment for the main menu (English) includes - All items -
The Module Assignment for the Top menu (English) includes - All items -

What happens is that the main menu is appearing on the right side of the page but with all menus (English and Greek) while the top menu in Greek is not appearing at all.

What changes need to be made?