Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author John Clause

    (@johnclause)

    https://qtranslatexteam.wordpress.com/interface/

    For example:

    switch(qtranxf_getLanguage()){
      case 'en':
      case 'fr':
      etc ...
    }

    This should be executed after action ‘plugins_loaded’, which most likely is already.

    Thread Starter Manley

    (@manley)

    Hi John,

    Thank you for your prompt support, as usual.

    I went through all support threads but I’m still unable to figure out these aspects:
    – In my case, should I use “qtranxf_get_url_for_language”?
    – In reference to the code I inputed in index.php (ref. my first post here), how exactly should I merge that with the switching formula?
    – Finally, in my index.php I found no trace of action plugins_loaded. Guess I’m searching the wrong php?

    It’d be great to have your guidance here.

    Cheers,

    Manley

    Plugin Author John Clause

    (@johnclause)

    It is up to you how you wish to program, there are many ways, it depends on your taste. Function qtranxf_get_url_for_language works on URL of your site, not external sites. Forget about ‘plugins_loaded’, if you do not know what I mean, it should not be a problem for you. If you wish me to program for you, then it is better be a paid job. You may do like this:

    <div id="appvideo">
    <?php
    switch(qtranxf_getLanguage()){
      case 'en': $url = 'https://www.youtube.com/embed/english-version?rel=0&showinfo=0'; break;
      case 'fr': $url = 'https://www.youtube.com/embed/french-version?rel=0&showinfo=0'; break;
      case 'it': $url = 'https://www.youtube.com/embed/italian-version?rel=0&showinfo=0'; break;
      default:
        $url = 'https://www.youtube.com/embed/z-AXekVimzU?rel=0&showinfo=0';
    }
    echo do_shortcode('[iframe class="app-video" src="'.$url.'" frameborder="0" width="100%"]');
    ?>

    or like this:

    <div id="appvideo">
    <?php
    $url = '[:en]https://www.youtube.com/embed/english-version?rel=0&showinfo=0[:fr]https://www.youtube.com/embed/french-version?rel=0&showinfo=0[:it]https://www.youtube.com/embed/italian-version?rel=0&showinfo=0[:]';
    echo do_shortcode('[iframe class="app-video" src="'.apply_filter('translate_text',$url).'" frameborder="0" width="100%"]');
    ?>

    Thread Starter Manley

    (@manley)

    Hi John,

    Thank you for your additional inputs. I’ve now made it to make everything work.

    Tomorrow I’ll happily make an additional donation, of the same amount as my previous, as a sign of appreciation of your support.

    Cheers,

    Manley

    Plugin Author John Clause

    (@johnclause)

    Thank you, Manley, I am glad to be able to help! Good luck to you in the further development of your site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change embedded YouTube URL based on language in php’ is closed to new replies.