Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #343337

    Hi there!
    I have a problem that I’m trying to solve for days without success: my site is not in English and then set to work with another language that came with the theme, but there is something is wrong with the child-theme: it seems that it doesn’t recognize a different language because some strings of the theme and of some plugins (the event calendar pro) are not translated. If I disable child-theme everything works perfectly.
    I tried many things and many of the suggestions that I found in this forum and on Google, but nothing has solved the problem.
    I installed CodeStyling Localization and followed instructions founded here:
    https://kriesi.at/support/topic/theme-update-and-child-theme/

    and here:
    https://kriesi.at/support/topic/translations-have-no-effect/
    I created new folder “lang” inside my child-theme directory and added following code on its function.php file.
    Tried this:

    add_action('after_setup_theme', 'avia_lang_setup');
    function avia_lang_setup()
    {
    $lang = get_stylesheet_directory()  . '/lang';
    load_child_theme_textdomain('avia_framework', $lang);
    }

    tried this:

    	add_action( 'after_setup_theme', 'my_child_theme_setup' );
    	function my_child_theme_setup() {
    	load_child_theme_textdomain( 'avia_framework', get_stylesheet_directory() . '/lang' );
    	}
    

    …and this:

    
    load_theme_textdomain( 'avia_framework', get_stylesheet_directory() . '/lang' );
    

    Really can’t understand what is wrong! Please heeeelp! :)
    Thanks in advance and congrats for Enfold, I really love it!

    #344478

    Hi marcella-metae!

    Thank you for using Enfold.

    Which specific strings are not being translated? Please give us a link to the actual page. When using the codestyling localization plugin, make sure that you rescan the strings of the theme or plugin language. Edit the strings then do not forget to click the generate mo-file button.

    Best regards,
    Ismael

    #345305

    Hi Ismael,
    I’ve done with the codestyling localization plugin all the things that you have written, and did them more than once.
    After many tests I have concluded that the plugin does not work properly in my case. Si I did all the translation work manually with “Po edit”, created separate files for child-theme and the event calendar pro.
    The main problem is, however, within this snippet that I use to translate a few words in the search bar of the Event calendar:

        // See the codex to learn more about WP text domains:
        // http://codex.wordpress.org/Translating_WordPress#Localization_Technology
        // Example Tribe domains: 'tribe-events-calendar', 'tribe-events-calendar-pro'...
         
        add_filter('gettext', 'theme_filter_text', 10, 3);
        function theme_filter_text( $translations, $text, $domain ) {
         
                // Copy and modify the following if {} statement to replace multiple blocks of text
                // Match the text you want you want to translate, preferably also match the text domain
                if($text === 'Search' && $domain === 'tribe-events-calendar') {
         
                        // The custom text you want instead
                        $text = 'Keyword';
         
                }
    			if($text === 'Near' && $domain === 'tribe-events-calendar-pro') {
         
                        // The custom text you want instead
                        $text = 'City';
         
                }
         
                return $text;
        }
    

    Currently I commented out this code, but when it’s active all the translation files are ignored and the English text appears.

    Hope you can help to solve, thanks in advance :)

    #346922

    Hi!

    Thank you for the info and sorry for the delay.

    It seems like you can’t translate created events but you can use the codestyling localization plugin to translate existing plugin strings, the events calendar overview page for example. Compatibility between WPML and Events Calendar is kind of a gray area and modern tribe developers are still working on it or at least noted that this issue is one of their top priority. I found a lot of thread with the same issue, here’s a few of them:

    https://tri.be/support/forums/topic/version-3-wpml-ready/
    http://wpml.org/forums/topic/the-events-calendar-pro-and-wpml/
    http://tri.be/support/forums/topic/wpml-events-calendar-pro/

    We recommend to contact the developers of the events calendar plugin and ask them for further insights. If it doesn’t help, I’m afraid you’ll have to switch to another plugin like Events Manager which includes an extension specifically for WPML compatibility. I’ll ask Kriesi to take a look. Please wait for his response.

    Cheers!
    Ismael

    #349981

    Thank Ismael,
    I know WPML isn’t supported by The Event Calendar, that’s why I decided not to use WPML and switch to WP multisite with a lot of extra work!
    Codestyling localization plugin doesn’t work so well for me. The only way for me to solve was to translate with po edit and drop .po .mo files directly into the lang folder of the plugin.
    I gave up using the above function suggested by Tri.be. in order to change texts inside the search bar, because it is not possible to translate those text set with that function. :-(
    Maybe Kriesi had a solution? Anyway thank you! :-)
    Cheers!
    Marcella

    #351062

    Hey!

    Thank you for the info. I already reported this issue to Kriesi so please wait for his response. I think you’re probably in the right direction with po edit. Make sure to create a backup of the lang folder in case you update the plugin and the theme.

    Regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Translation with mo/po file not working with Child Theme’ is closed to new replies.