- This topic has 12 replies, 3 voices, and was last updated 3 years, 8 months ago by Tom.
-
AuthorPosts
-
August 3, 2020 at 10:53 am #1386099Craig
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!
August 3, 2020 at 12:32 pm #1386221LeoStaffCustomer SupportHi 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 π
August 3, 2020 at 12:41 pm #1386241CraigThank 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
August 3, 2020 at 12:44 pm #1386243LeoStaffCustomer SupportDid you add it in the child theme’s
function.php
?August 3, 2020 at 3:26 pm #1386356CraigLeo –
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
August 4, 2020 at 3:31 am #1386697CraigLeo –
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
August 4, 2020 at 9:10 am #1387150TomLead DeveloperLead DeveloperCan 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 π
August 4, 2020 at 9:43 am #1387204CraigTom, 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
August 4, 2020 at 1:04 pm #1387389TomLead DeveloperLead DeveloperOne 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.
August 7, 2020 at 9:03 am #1391713CraigTom – 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
August 7, 2020 at 9:06 am #1391721TomLead DeveloperLead DeveloperThat’s because I added it in 1.11.0 which was released yesterday. The field *should* be translatable by WPML now π
August 19, 2020 at 8:43 am #1409761CraigOk, 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.
August 19, 2020 at 1:12 pm #1410096TomLead DeveloperLead DeveloperThere 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.
-
AuthorPosts
- You must be logged in to reply to this topic.