Support » Plugin: Transposh WordPress Translation » Use transposh in Ajax event

  • roryrory


    I cannot get transposh to translate data retrieve from ajax. The ajax works well but the content is not translate.
    Can you help me? What i am missing?

    Here is my example with accessing the page in french for example

    The transposh.php on_init()
    if (isset($_GET[‘action’]) && $_GET[‘action’] == ‘essairor’) {
    $this->target_language = transposh_utils::get_language_from_url($_SERVER[‘HTTP_REFERER’], $this->home_url);
    $this->attempt_json = true;

    the html
    <button id=”ess”>ee</button>

    The javascript
    jQuery(document).ready(function($) {
    $(‘#ess’).on(‘click’,function(e) {
    url :ajaxurl,
    data: {
    success: function( data ) {
    alert( data);

    The server side php
    add_action( ‘wp_ajax_essairor’, ‘essairor’ );
    add_action(‘wp_ajax_nopriv_essairor’, ‘essairor’);
    function essairor() {
    echo json_encode(“good bye”);

  • You must be logged in to reply to this topic.