Languages not working with customized template files

Home Forums Additional Help Translations Languages not working with customized template files

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1008206
    Eugene
    Guest

    I have WP theme with customized The Event Calendar files.
    wp-content\themes\my_theme\tribe-events\single-event.php
    In this file I have such line
    <a href="<?php echo esc_url( tribe_get_events_link() ); ?>"> <?php printf( __( '&laquo; All %s', 'the-events-calendar' ), $events_label_plural ); ?></a>

    “All” is not translated, but if I delete this file, it works with default file wp-content\plugins\the-events-calendar\src\views\single-event.php
    How I can solve this problem?

    #1008346
    George
    Participant

    Hey Eugene,

    This problem stems from the fact that translations rely on the plugin’s .mo and .po language files, which are generated anew before each release of the plugin.

    The problem is that these files point to strings in the core plugin, so if you have a customized template, then this new custom file in your theme is not a part of the .mo and .po files and so will not be translated as part of The Events Calendar.

    The only solution would be to generate new .mo and .po files – you can search online for information on how to do that, there are a number of ways.

    I hope this information helps!

    — George

    #1008613
    Eugene
    Guest

    Hi, George
    Thank you for your help!

    #1008685
    Eugene
    Guest

    Yet there is more I would like to ask. Is there a chance this could work alike with WooCommerce plugin, where the translations apply even to a re-written plugin file, as far as the .po and .mo files have the needed words and phrases added.

    In woocommerce plugin all languages works fine in custom files(wp-content\themes\my_theme\woocommerce\single-product-reviews.php) This file take translation from wp-content\languages\plugins\lang_Lang.po

    Please let me know if that is clear enough, thanks!

    #1008768
    George
    Participant

    Wow, I didn’t know that WooCommerce was able to do that, that is awesome! The fact that it is possible does give me hope that, yes, at some point we could add functionality for this to ensure translation files were up-to-date with custom templates.

    For now there is still no way, unfortunately 🙁

    I’m sorry to disappoint Eugene!

    Sincerely,
    George

    #1009098
    Eugene
    Guest

    Ok. Thanks for the quick response

    #1009641
    George
    Participant

    Sorry to have had to share bad news, Eugene 🙁

    Best of luck with your site!
    George

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Languages not working with customized template files’ is closed to new replies.