[Resolved] Off Canvas Menu – need in Spanish for Spanish site…

Home Forums Support Off Canvas Menu – need in Spanish for Spanish site…

  • This topic has 12 replies, 3 voices, and was last updated 1 month ago by Tom.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1386099
    Craig

    Hi –

    Can’t seem to find or understand how to offer our Spanish menu ( I used the WPML plugin ) in Spanish.

    Currently, Customize -> Off Canvas Panel -> Desktop Toggle Label is set to Browse Cards.

    Any chance there is a way to have this say ‘Examinar Tarjetas’ once the URL flips to the /es version?

    Thanks so much GP team!

    #1386221
    Leo
    Staff
    Customer Support

    Hi there,

    Can you give this PHP snippet a shot and see if it works?

    add_filter( 'option_generate_menu_plus_settings', function( $settings ) {
        if ( 'es_ES' === get_locale() ) {
            $settings['mobile_menu_label'] = 'SPANISH TOGGLE TEXT';
        }
    
        return $settings;
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Let me know 🙂

    #1386241
    Craig

    Thank you! So – I installed in functions.php, and it does not work, the text does not change. With that said, I had trouble running another add_filter with the same type of if ( ‘es_ES’ === get_locale() ) statement. I ran get_localed() on my server to confirm the es_ES and it does indeed return back the country code, but something is just not allowing that function to return properly.

    Do you think it is something I should take up with my host – maybe something not configured correctly with PHP?

    Thanks so much!

    Craig

    #1386243
    Leo
    Staff
    Customer Support

    Did you add it in the child theme’s function.php?

    #1386356
    Craig

    Leo –

    I thank you – yes, although I had not set up a child theme yet for this site. It is now set up, I added it in functions.php.

    I also put in a quick note to my host support. Happy to give you access and a few bucks via paypal – I appreciate your efforts!

    Craig

    #1386697
    Craig

    Leo –

    Do you think it SHOULD be working in the child theme? Trying to eliminate GP and see if the host server is the issue?

    Thanks, Craig

    #1387150
    Tom
    Lead Developer
    Lead Developer

    Can you give this a shot instead?:

    add_filter( 'option_generate_menu_plus_settings', function( $settings ) {
        if ( 'es_ES' === get_locale() ) {
            $settings['off_canvas_desktop_toggle_label'] = 'SPANISH TOGGLE TEXT';
        }
    
        return $settings;
    } );

    Let me know 🙂

    #1387204
    Craig

    Tom, thank you so much. Added to child theme to functions.php and does not work. Still shows the text that is in the field with Customizer. I’m sorry this is complicated, appreciate your efforts!

    Craig

    #1387389
    Tom
    Lead Developer
    Lead Developer

    One thing to try..

    In wp-content/plugins/gp-premium, there’s a file named: wpml-config.xml

    In it, find this entry:

    <key name="generate_menu_plus_settings">
        <key name="mobile_menu_label"/>
    </key>

    And replace it with this:

    <key name="generate_menu_plus_settings">
        <key name="mobile_menu_label"/>
        <key name="off_canvas_desktop_toggle_label"/>
    </key>

    That should make the field translatable within WPML.

    #1391713
    Craig

    Tom – so appreciate the efforts. When I viewed the XML file, that key name for off canvas was actually already in the script. Weird.

    I am going to reach out to WPML because I’ve converted the entire site at this point, with the exception of that one menu label.

    Thanks again!

    Craig

    #1391721
    Tom
    Lead Developer
    Lead Developer

    That’s because I added it in 1.11.0 which was released yesterday. The field *should* be translatable by WPML now 🙂

    #1409761
    Craig

    Ok, got it to work, but I had to place that code in the regular functions.php file, and not my child, which is strange… but seems to work.

    #1410096
    Tom
    Lead Developer
    Lead Developer

    There isn’t a technical difference between child and parent functions.php files.

    You shouldn’t ever add anything to the parent theme, as you’ll lose everything when you update.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.