Menu items order

Ce sujet contient 0 réponses et 5 voix, et a été mis à jour par  Anonyme il y a Il y a 13 ans, 1 mois.

Visualisation du message 9 (1 sur 9, 9 au total)
  • Auteur
    Articles
  • #2965

    Anonyme

    Hello,

    I was facing the same problem.here is the solution I found. not sure it is the best one:

    It does not use the inclusion of the page selection as described in the tutorial.

    1- I create the pages that will be pointed by the menu.

    2- I go in the menu definition page and I create a primary menu, inserting in it all the pages in the proper order ( inserting the pages of 1 language only is enough)

    3- for each menu item, I change the nagigation title to a default one:

    ex: french+ english : french title is « Bonjour », english one is « Hello ». I put hello as navigation title.This title only serve as a key in the dictionary

    4-I go in xili dictionary and create a new term (hello with the above exemple)

    5-i define a translation for each language (Hello for us_en and Bonjour for fr_fr) with the above exemple

    6-in xili-dictionary I generate an MO file for EACH of the language

    7-I insert the lanquage titles or flags in the menu bar as indicated in the doc

    8-when I switch from one language to the other the menu titles are in the order define in the menu and correctly translated.

    Of course it would be 100 times easier if xili-language was able to recognise on its own that the pages inserted in a navigation menu are linked to pages in other language and use directly the titles of the pages themselves for translation without having to resort to the dictionary. It may be possible but I don’t know how to do it.

    regards

    #2966

    Anonyme

    hello,

    I am sorry, but I found out that the method described above does not really work: The menu titles are well translated, but xili-language does not do the switching from one language to another when selecting the page. It is always the page included in the menu that is displayed; no switching between different language versions of the page is done.

    I found however a way to change the order by defining the « order » field in the page attribute definition panel. The list of menu options is then ordered according to this field.

    The bad news for me is that I was expecting to have multilevel menus translated.

    hovering over each of my menu option triggers the apparition of a submenu which is expected to display in the proper language and the selection of the menu item should point to the proper page translation.

    I don’t know how to do that with xili-language.

    I would appreciate if anyone has a solution for this.

    Thanks

    #2967

    Anonyme

    when pages in different languages are linked, you must verify that the links are set in each page – example : if page 2 is in english, and page 27 in japanese – the link in page 2 edit must be 27 for japanese and the link in page 27 edit must be 2 for english…

    Give me one week to test multilevel menus… it is the summer week without screen to rest my eyes (and brain)…

    the author ;-)

    #2968

    Anonyme

    I implemented a crude solution for the translation of multilevel menu:

    I copied the header.php file from the original twentyeleven theme in the twentyeleven-xili theme.

    The function wp_nav_menu is called in this file to display the menu.This function may be provided with a pointer to a specific menu.

    I have added a function ‘twentyeleven_get_localized_menu’ in functions.php to try to locate a specific localized menu, from the name of the primary menu and the name of the current language. If the search succeeds, then the localized menu is displayed instead of the original one.

    exemple: my main menu name is ‘navigation’; if I define another menu in the wp interface and call it ‘navigation_en_us’, this specific menu will be displayed instead when switching to english_us language.

    This approach seems to work fine. I can contribute the changes if anyone is interested.

    regards

    #2969

    Anonyme

    To illustrate a way used on one multilingual website with specific menus for each language some code below… if then else can be changed by switch and names of menus can use suffixes,

    <?php
    $curlang = the_curlang();
    if ( "en_us" == $curlang ) {
    wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );
    } if ( "fr_fr" == $curlang ) {
    wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primaire' ) );
    }

    the menus named primary or primaire or primary-es_es must be preset in WP admin apparance UI

    Enjoy !

    #2970

    xiligroup dev
    Keymaster

    In this topic, it is very important to understand that xili-language plugin is very powerful for multilingual cms websites. The automatic process provided in XL UI to create menu is for simple pages menu (and newbies) BUT, as shown above, when you need more complex menus (and specially adapted for each language), you need to use template tags and some php lines in a theme file copied in child theme…

    dev.xiligroup

    xili-language author

    #2971

    Anonyme

    hello

    i’m new to xili-language and i would like to understand how to order elements in the menu (the alphabetical ordering doesnt fit to me).

    can you explain me how to achieve this ?

    i’m using Twentyten-xili theme which allows only 1 level of menu (primary) ; the method provided by Michel doesnt seem to work.

    thanks

    #2972

    Anonyme

    if it is about automatic insertion of pages, to ordering, you must set order in current pages edit list.

    if it is about automatic languages insertion, to ordering, you must set order in xili-language setting list.

    Hope that help…

    #2975

    Anonyme

    thanks Michel.

    it’s about insertion of pages ; where is that edit list you’re talking about ? i’m not an expert so could you please talk me to the right place with the right code ?

    thank a lot !

Visualisation du message 9 (1 sur 9, 9 au total)

Vous devez être connecté pour répondre à ce sujet.