Appointments+ and qTranslate issues

Hello
I'm using the appointments+ plugin along with qTranslate plugin and I came across some issues and hope someone can help me.
My site: http://v-designs.ch/simair/en/termin-buchen/
The description which is loaded under the services/service-providers isn't loaded in the currently present language. Also when clicking on "next month" the current language isn't part of the permalink. Any suggestions how I can change this?
Thanks in advance!

  • Ash
    • WordPress Hacker

    Hello @Damian

    Welcome to WPMU community!

    I hope you are well today and thanks for asking the question.

    The next month links is generated inside the plugin. Also I think the description is related too. Let me ask the developer @Vladislav for some suggestions.

    Cheers
    Ash

  • Vladislav
    • Dead Eye Dev

    Hello,

    By default, the service descriptions are being shown as excerpts, which means they aren't being filtered with "the_content". This seems to be the main cause of the services description problem - in fact, for one of your services I have managed to catch the beginning of the English description, which probably means that qTranslate didn't have had a chance to do its thing and discard the language it won't be using for display. To remedy this, can you please try adding description="content" to your services shortcode? This will apply default WP content filters and hopefully allow qTranslate to do its thing on the service descriptions.

    As for the URL, we're using standard add_query_arg call to generate the link, but it seems that qTranslate doesn't work too well with it. As a quick fix, you may want to hook up to the "app_service_href" filter and dispatch proper linking with qTranslate.

  • Damian
    • New Recruit

    Hello Vladislav

    I've added the description property to service and the service provider. Now it's including both language versions. Also the text contains now html.

    Can you explain me where I can update the "app_service_href" filter and how do I have to manipulate it?

    Thanks!

  • Vladislav
    • Dead Eye Dev

    Hello,

    Fixing the URLs using the mentioned filter would require a little bit of custom code in your theme's functions.php or in a mu-plugin (which is basically a .php file in your wp-content/mu-plugins folder). The code could look like this:

    function my_connect_qtrans_apps () {
    	if (function_exists('qtrans_useCurrentLanguageIfNotFoundShowAvailable')) {
    		add_filter('app_pre_content', 'qtrans_useCurrentLanguageIfNotFoundShowAvailable', 0);
    		add_filter('app_the_content', 'qtrans_useCurrentLanguageIfNotFoundShowAvailable', 0);
    	}
    	if (function_exists('qtrans_convertURL')) {
    		add_filter('app_service_href', 'qtrans_convertURL', 0);
    		add_filter('app_worker_href', 'qtrans_convertURL', 0);
    	}
    }
    add_action('plugins_loaded', 'my_connect_qtrans_apps');

    The code above will ensure that your descriptions are displayed in proper language, as well as make sure that your links are pointing to the properly localized location.

      • Ash
        • WordPress Hacker

        Hi @Stefan

        Would you please use the following code in your theme's footer.php after wp_footer() ?

        <?php if( isset( $_REQUEST['lang'] ) ) { ?>
        <script type="text/javascript">
        jQuery(function($) {
          $('div.next a, div.previous a').each(function() {
            var url = $(this).attr('href');
            href = url.replace('#', '&&lang=<?php echo $_REQUEST['lang']; ?>#');
            $(this).attr('href', href);
          });
        });
        </script>
        <?php } ?>

        Let me know if it works for you.

        Hope it helps :slight_smile: Please feel free to ask more question if you have.

        Cheers
        Ash

  • Saurabh
    • New Recruit

    Hi @Stefan,

    Hope you are well today!

    The following code would fix the translation after clicking 'Show available times':

    add_filter( 'app_service_href', 'incsub_modify_href_translate' );
    
    function incsub_modify_href_translate ( $href){
        return add_query_arg( array( "lang"=>'en'), $href );
    }

    As for the description, I'd need to have a closer look. However, you'd need to start a new thread for yourself and grant me support access.

    Best

    Saurabh

  • Saurabh
    • New Recruit

    Hi @Stefan,

    Yes, that's right. I apologise for not specifying that. Please paste it in functions.php. This will however not fix the excerpts translation. I'll need to have support access for that if the solution posted earlier isn't working for you.

    You'd need to start a new thread for us to be able to provide better help with this.

    Best

    Saurabh

  • Stefan
    • New Recruit

    Hello, unfortunately it doesn't work, I mean it works, when I press show available times it stays on the selected language but in that situation it's not possible to book an appointment when I press on a button on a time slice. The two bits of code u've provided pasted in functions.php look like that:
    if (function_exists('qtrans_useCurrentLanguageIfNotFoundShowAvailable')) {
    add_filter('app_pre_content', 'qtrans_useCurrentLanguageIfNotFoundShowAvailable', 0);
    add_filter('app_the_content', 'qtrans_useCurrentLanguageIfNotFoundShowAvailable', 0);
    }
    if (function_exists('qtrans_convertURL')) {
    add_filter('app_service_href', 'qtrans_convertURL', 0);
    add_filter('app_worker_href', 'qtrans_convertURL', 0);
    }
    }
    add_filter( 'app_service_href', 'incsub_modify_href_translate' );

    function incsub_modify_href_translate ( $href){
    return add_query_arg( array( "lang"=>'en'), $href );
    }

    I've granted you support acces to the plugin. Thank you for the support

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.