• Resolved daymobrew

    (@daymobrew)


    I have a plugin that inserts text into WooCommerce Order Completed email. This works.

    I recently i18n’d the code and a colleague used Loco Translate to translate the strings into Dutch and German. I added Dutch and German as WordPress site languages and I am currently running it in Dutch. Unfortunately the translations do not show up when I test my code.

    Code: https://gist.github.com/damiencarbery/6d7a0a26cf31d1532e131def134bfc5e

    Screenshot: https://snipboard.io/fGWpYA.jpg (I am using Preview Emails plugin; it is translated)

    When I look at the global $i10n variable I see that the translated file has been correctly found but the ‘entries’ element is empty:

        '/wp-content/languages/loco/plugins/tracking-info-to-wc-order-nl_NL.l10n.php' => 
    array (
    'nl_NL' =>
    array (
    'tracking-info-to-wc-order' =>
    WP_Translation_File_PHP::__set_state(array(
    'headers' =>
    array (
    ),
    'parsed' => false,
    'error' => NULL,
    'file' => '/wp-content/languages/loco/plugins/tracking-info-to-wc-order-nl_NL.l10n.php',
    'entries' =>
    array (
    ),
    'plural_forms' => NULL,
    )),
    ),
    ),

    How should I go about debugging this?

    I have also converted the Loco Translate translations into PO and MO files and put them into my wp-content/plugins/tracking-info-to-wc-order/languages directory but that did not fix the issue. (I deleted those files before taking the above screenshot and $i10n data).

Viewing 1 replies (of 1 total)
  • Thread Starter daymobrew

    (@daymobrew)

    My code was missing the domain in the l10n calls.

    Something like:

    __( 'English string' );

    instead of:

    __( 'English string', 'tracking-info-to-wc-order' );

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.