Home › Forums › Calendar Products › Events Calendar PRO › Language translation issue with customized theme
- This topic has 6 replies, 2 voices, and was last updated 8 years, 5 months ago by
urbanstorm.
-
AuthorPosts
-
November 24, 2017 at 10:05 am #1390975
urbanstorm
ParticipantMy theme came with a customized layout for the Events Calendar. But what it means is that my translation with WPML isn’t working for the meta titles in the right column of the Single Event view.
How can I resolve this? Is there a way of using the functions.php file or something similar to fix it?
Here is an example of the code being used to generate the layout:
<?php esc_html_e( ‘Time’, ‘webnus_framework’ ) ?>
Thanks!
November 24, 2017 at 12:31 pm #1391138urbanstorm
ParticipantI tried adding the following to functions.php which worked BUT it made most the website text on the English language side disappear. I’m sure it’s a simple fix, but my php knowledge is limited. Thanks for any help you can give:
add_filter('gettext', 'webnus_framework'); add_filter('ngettext', 'webnus_framework'); function webnus_framework($translated) { if ( ICL_LANGUAGE_CODE=="fr" ) { $translated = str_ireplace('Time', 'Temps', $translated); $translated = str_ireplace('Cost', 'Coût', $translated); $translated = str_ireplace('Location', 'Emplacement', $translated); $translated = str_ireplace('Share this Event', 'Partagez cet événement', $translated); return $translated; } }November 24, 2017 at 3:09 pm #1391223Geoff B.
MemberGood evening David and welcome back!
There are 2 ways to tackle this:
- Scan your theme for strings with WPML. The strings from your theme should appear in String Translation.
- Tweak you customized layout. Ideally you should do this in child theme so that you do not loose your tweaks.
To tweak the layouts, you might want to read our Themer’s guide to get a sense of how that works.
Let me know how that goes.
Best regards,
Geoff B.November 24, 2017 at 3:14 pm #1391228Geoff B.
MemberOops, I just saw your follow-up answer.
If you want to go down that route, you could still tweak your theme’s custom view.
You could then hardcode the translation for specific strings using an approach such as the one detailed here: https://wpml.org/forums/topic/if-conditional-for-language/Have a good weekend,
Geoff B.
November 24, 2017 at 11:01 pm #1391392urbanstorm
ParticipantThanks Geoff, that last resolution worked perfectly.
November 27, 2017 at 2:41 pm #1393081Geoff B.
MemberGood evening David,
I am super stoked that did the trick for you.
You are welcome back in our support forums any time 🙂
For now, I am going to close this thread.
Have a great week!
Geoff B.
-
AuthorPosts
- The topic ‘Language translation issue with customized theme’ is closed to new replies.
