• Resolved vaniivan

    (@vaniivan)


    Loco won’t pickup translations from WooCommerce email templates inside theme folder.
    I tried syncing the pot file, syncing translation file, but no go, the translations are just ignored.
    One example from the ‘customer-processing-order.php’ template:

    <h2 style="font-weight:normal;font-size:24px;margin:0 0 10px; "><?php esc_html_e(__('Thanks for your order!', "freshio-child")) ?></h2>

    I’ve used freshio-child text-domain as in other translation strings inside this theme, which do get picked.

    • This topic was modified 2 years ago by vaniivan.
    • This topic was modified 2 years ago by vaniivan.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tim W

    (@timwhitlock)

    Loco won’t pickup translations from WooCommerce email templates inside theme folder.

    I don’t know anything about WooCommerce email templates, but if you define a text domain in your child theme Loco Translate can extract strings from it, no problem. Likewise, it can generate translation files for your “freshio-child” domain also.

    How you load these translation files at runtime, and have WooCommerce use them for emails under the current locale setting is beyond what my plugin actually does.

    I tried syncing the pot file, syncing translation file …

    From where? to what? Are the strings in your freshio-child PO file?

    Thread Starter vaniivan

    (@vaniivan)

    This is a standard WooCommerce template override behaviour. There is a “templates” folder inside the WooCommerce plugin dir, and when a “woocommerce” folder is created in the theme dir, the templates from the theme dir override those in woocommerce “templates” folder.
    The WPML string translation plugin had no problem translating them.

    Loco plugin has the “Sync” button in the pot file editor, which scoops up all the localization calls from the theme/plugin being translated.

    Update:
    when I equalized all text-domains to “freshio-child” inside email template folder, the Loco plugin managed to scoop them up during sync, but even though I translated them, the translations don’t show up in WooCommerce order emails.

    • This reply was modified 2 years ago by vaniivan.
    Plugin Author Tim W

    (@timwhitlock)

    when I equalized all text-domains to “freshio-child” inside email template folder, the Loco plugin managed to scoop them up during sync

    Good. This is what Loco Translate does, and its part seems to be working. If you have a file named like “languages/themes/freshio-child-{locale}.mo” or “languages/loco/themes/freshio-child-{locale}.mo” then its job is done.

    but even though I translated them, the translations don’t show up in WooCommerce order emails.

    My plugin isn’t responsible for this part. When the email is rendered (which I know nothing about) the freshio-child text domain must be loaded with the correct locale set at the time. How WordPress and/or WooCommerce achieves this is beyond my knowledge and beyond the functioning of my plugin.

    The one additional role Loco Translate plays is to allow the path to the MO file to be modified (i.e. placed in a different folder). As per this FAQ try everything in the normal (system) locations to establish if this is a factor.

    Thread Starter vaniivan

    (@vaniivan)

    Thanks for sticking with me, moving the PO/MO files from /languages/loco/themes to /languages/themes solved the “issue” with WooCommerce.

    Cheers!

    Plugin Author Tim W

    (@timwhitlock)

    Ok. So it’s the custom file loader that doesn’t work. As per the FAQ, this could be for various reasons, but most likely the translations are being requested before Loco Translate has been allowed to start up.

    As your child theme is of your own authoring it won’t be updated from an external source. That means that keeping translations in languages/themes should be safe.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Loco doesn’t pickup translations from woocommerce templates inside theme folder’ is closed to new replies.