How Can I Use qTranslate Language Tags in an AJAX Popup

2.2k Views Asked by At

I just set up Magnific Popup but unfortunately, I do not understand how to get qTranslate's language tags to work within the HTML file I created for the AJAX popup.

Or should I be working on embedding a wordpress page (in which the qTranslate plugin works well) within the popup?

The HTML file below with the language tags included can be seen at http://chinasonoma.com/?page_id=9 when "What is Craft Beer?" is clicked on. "中文" should be invisible while English is selected.

This is my first post, so please let me know if you need any further information.

<<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<div id="custom-content" class="white-popup-block" style="max-width:600px; margin: 20px auto;">
    <h3>What is Craft Beer?</h3>
    <style>
    #custom-content img {max-width: 100%;margin-bottom: 10px;}
    </style>
    <p>Craft Beer is a specialty product </p>   

    <p><!--:zh-->中文<!--:--></p>

<img src="http://chinasonoma.com/wp-content/uploads/2013/06/sampler.jpg"/>

 </div>
</body>
</html>
1

There are 1 best solutions below

2
On

I think the answer is quite simple.

Two possibilities:

  1. Proper use of a filter:

    <p><?php apply_filters('the_content','<!--:zh-- >中文<!--:-->'); ?> </p>

  2. Use the function qtrans_getLanguage();

    <p><?php if(qtrans_getLanguage()=="zh") { echo "中文"; } ?></p>

Hope this helps.