Translation not working in new Event Tickets Plus

Home Forums Ticket Products Event Tickets Plus Translation not working in new Event Tickets Plus

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1036451
    Stéphane Bergeron
    Participant

    Hi,

    I’ve been testing the new plugin versions on a local testing server and things seem to work OK once I replace template overrides with copies using the new version but I have been unable to make the French translation of the Event Tickets Plus plugin work. All strings always display in English.

    I use POEdit and tried updating the translations from the PO files, from source, creating new ones but nothing worked. I always only see the English strings.

    Then I started poking in the plugin files to make sure the text domain was correct and nothing else was weird and I found why it didn’t work.

    If you look at the event-tickets-plus.php file at the root of the plugin folder, the only call to load_plugin_textdomain in the entire plugin is on line 43 and that is inside the following conditional: if ( event_tickets_plus_is_incompatible_tickets_core_installed() ) { …textdomain code }

    That event_tickets_plus_is_incompatible_tickets_core_installed() function is defined further down in the same file at line 70. Since I AM using a compatible version, that function always returns “false” so the translations are never actually loaded. I removed the above conditional on line 41 (closing at line 47) and the French translation worked right away.

    So something is broken with that logic as it seems to be loading the new plugin’s translation files only if one is running an incompatible version and no other action is taked if the function returns false. In that case, no translations are loaded at all which makes no sense to me.

    What’s up with that? In any case, I’ll definitely wait before upgrading on the live site until this is resolved.

    Thanks!

    #1037167
    Nico
    Member

    Howdy Stéphane,

    Welcome to our support forums and thanks for reaching out to us. Also thanks for the detailed issue report. This might be a bug as you state, before confirming this I would try to reproduce this locally. It would be great if you could share your system information with me so I can check if everything looks right on that end. I see that event_tickets_plus_is_incompatible_tickets_core_installed logic is about checking for the ‘right versions’ of the matching plugins.

    Please let me know about it so I can try to reproduce this,
    Best,
    Nico

    #1037830
    Stéphane Bergeron
    Participant

    This reply is private.

    #1038307

    I can confirm that the translation is also not working on my installation…
    I got the same problem with German. However, the above fix does not seem to work for me. (or I’m getting it wrong)

    I’ll attach my system information in an additional post.

    #1038308

    This reply is private.

    #1038935
    Nico
    Member

    Hey Folks,

    Thanks for sending over your system information, and sorry for the delay in my reply.

    Well I tested this on my local install (clean WP install with our plugins) and it seems to work as expected. I do see some strings in English, but that might be due to some strings are not translated yet: http://translations.theeventscalendar.com/projects/event-tickets-plus

    This is how I see Ticket Plus in both

    French: https://cloudup.com/iGCjqgjKr3V
    German: https://cloudup.com/ircRJ55HYhR

    Everything looks good in your system information. Can you both please follow the steps described in our Testing for conflicts guide? This way we can see if this is a problem in our plugin or a conflict with the theme or other installed plugins.

    @ Stéphane, that function is returning false for me. The logic is fine, it shouldn’t return true if both Ticket and Tickets Plus are installed and if their versions are the requiered. Can you please temporarily override the function code with the one blow so we can see where it’s failing?

    https://gist.github.com/niconerd/1f7bcb3b10882eda42a9

    @ Lukas, I’ll try to help you both here, but I’ll be focusing on Stéphane’s feedback as he is the original poster and your problem might not be the same. If you want to open a new thread for your issue at any point, that’s fine as well. I you wanna follow along this one, it’s ok too.

    Please let me know about it,
    Best,
    Nico

    #1039185
    Stéphane Bergeron
    Participant

    Hi Nico,

    As I said, it’s normal that the function returns false. My install does NOT have *incompatible* versions. The flaw in logic is instead at line 41:

    if ( event_tickets_plus_is_incompatible_tickets_core_installed() ) { … load textdomain code … }

    Since that function at line 70 returns false, the code for loading the translation is NOT run. There’s no other function to load translations for Tickets Plus in the plugin.

    #1039882
    Nico
    Member

    Hi Stéphane,

    That’s weird, because it’s returning false in my local install but I’m seeing the translation as expected. Sorry I thought you were getting true in that check. I’m still mostly sure the logic in there is legit, but I might be miss-interpreting the code.

    I’ll re-check with one of our developers to be 100% sure about it, and let you know.

    Have a great weekend,
    Best,
    Nico

    #1041248
    Nico
    Member

    Hey Stéphane,

    Jus wanted to give you a heads up on this. I’ve just reviewed this with one of the developers and it turns out that indeed we are dropping the ball here, and missing to load the text domain on actual activation. You were right 🙂

    This will be included in the upcoming maintenance release of Event Tickets Plus, but if you want to manually patch the file till this is released you can take the translation load out of the compatibility check statement:

    ...
    function event_tickets_plus_init() {

    tribe_init_tickets_plus_autoloading();

    $langpath = trailingslashit( basename( dirname( __FILE__ ) ) ) . 'lang/';
    load_plugin_textdomain( 'event-tickets-plus', false, $langpath );

    if ( event_tickets_plus_is_incompatible_tickets_core_installed() ) {
    add_action( 'admin_notices', 'event_tickets_plus_show_fail_message' );
    return;
    }
    ...

    Thanks a lot for reporting this, and sorry for not seeing your point earlier (it appeared to work on my end),
    Best,
    Nico

    #1042013

    Hi Nico,

    may I use this thread for my purposes once more ;)?
    The fix above solves the problem for me as well – with one exception:
    The “Add to cart” button is still in english.

    I looked through the translation files and can’t even find the string in there. Can you point me where it comes from and how to translate it into German?

    Thanks a lot!

    #1042391
    Nico
    Member

    Hey Lukas,

    I see that string in Event Tickets Plus, try re downloading the mo/po files and replace those in the lang folder of the plugin (wp-content/plugins/event-tickets-plus/lang).

    If that doesn’t solve the problem, can you please open up a new thread for this? Having just a user/issue per thread usually makes them move faster. When creating the new thread please be sure to Test for conflicts and include your system information, that will surely help getting a better reply. You can also include a link back to this thread if you want.

    Best,
    Nico

    #1042538
    Geoff
    Member

    Hey there,

    Great news–we have a fix for this issue ready and it will be shipping today in version 4.0.2. Please keep your eyes peeled for the update and let us know if any other issues pop-up in a new thread and we’d be happy to help.

    Thanks again for your patience while we worked on this!

    Cheers,
    Geoff

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Translation not working in new Event Tickets Plus’ is closed to new replies.