• Hey,

    I’m working with this paid plugin called “Booked” and in their php source code they have two similar translations as follows:

    line:939 echo '<h2><span>' . sprintf( _n( esc_html(_x( 'Available Appointment on %s', 'Single Appointment', 'booked' )), esc_html(_x( 'Available Appointments on %s', 'Multiple Appointments', 'booked' )), $total_available ), '</span><strong>'.$date_display.'</strong><span>') . '</span></h2>';

    and

    line:1296 echo '<h2'.(!$showing_prev ? ' class="booked-no-prev"' : '').'><span>'.sprintf(_n('Available Appointment on %s','Available Appointments on %s',$total_available,'booked'),'</span><strong>'.$date_display.'</strong>').'</h2>';

    When I sync the main language template in Loco, i’m only detecting the second occurrence on line:1296. I’m trying to translate it in German (Formal) System language.

    When I check the following path /wp-content/languages/plugins/booked/booked-de_DE_formal.po, i’m only finding this

    #: includes/functions.php:1296
    #, php-format
    msgid "Available Appointment on %s"
    msgid_plural "Available Appointments on %s"
    msgstr[0] "VerfГ?gbarer Termin am %s"
    msgstr[1] "VerfГ?gbare Termine am %s"
    

    so the lines below which I can see in the Booked plugin .pot file seem to be treated as obsolete/can’t be located by Loco?

    #: includes/functions.php:938
    #, php-format
    msgctxt "Single Appointment"
    msgid "Available Appointment on %s"
    msgstr ""
    
    #: includes/functions.php:938
    #, php-format
    msgctxt "Multiple Appointments"
    msgid "Available Appointments on %s"
    msgstr ""
    

    Does anyone have an idea how can I make it so they’re being detected?

    P.S. Reading a bit more through the FAQ and checking a bit more of the plugin’s .pot file, it seems that there’s a mismatch between the lines of the Booked plugin’s .php file containing the translatable strings and the Booked plugin’s .pot file that tells the software which strings are available. Does that mean that the author hasn’t updated their .pot file? It seems that if i don’t perform the sync template action from Loco, the translations appear. But it’s still a bit weird bcs it seems that some translations with mismatched lines in the files are picked up by Loco while others are not

    • This topic was modified 1 year, 6 months ago by mom4i911024.
    • This topic was modified 1 year, 6 months ago by mom4i911024.
    • This topic was modified 1 year, 6 months ago by mom4i911024.
    • This topic was modified 1 year, 6 months ago by Jan Dembowski.
Viewing 1 replies (of 1 total)
  • Plugin Author Tim W

    (@timwhitlock)

    I think the problem may be that one of those _x calls is being passed to a _n call. This is weird (because it’s translating a translation) but probably “works” because it just performs the %s substitution on the initial translation (as no translation of the translation will be found). However, this approach won’t work with languages that require more than two plural forms, so I’d consider it a bug.

    This may be the reason it’s not picked up, although I’ve not tested this.

    Coding issues aside, if the author has provided a POT template file you should use it, and not regenerate it unless you have good reason. I’m not clear on whether you’re regenerating it, or why.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin translation not detected in .pot file’ is closed to new replies.