Language translation issue with customized theme

Home Forums Calendar Products Events Calendar PRO Language translation issue with customized theme

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1390975
    urbanstorm
    Participant

    My 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!

    #1391138
    urbanstorm
    Participant

    I 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;
    }
    }
    #1391223
    Geoff B.
    Member

    Good evening David and welcome back!

    There are 2 ways to tackle this:

    1. Scan your theme for strings with WPML. The strings from your theme should appear in String Translation.
    2. 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.

    #1391228
    Geoff B.
    Member

    Oops, 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.

    #1391392
    urbanstorm
    Participant

    Thanks Geoff, that last resolution worked perfectly.

    #1393081
    Geoff B.
    Member

    Good 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.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Language translation issue with customized theme’ is closed to new replies.