• Resolved newshop

    (@newshop)


    Hello,
    I would like to change some german strings and wanted to use Loco Translate, but the translation I enter doesnt has any effect. It still shows the old translation “Zahlungsmethode” for “Payment method” in table footer. What am I doing wrong? I used Loco Translate for all of my plugins, this is the first time it doesnt work. Any help would be really appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter newshop

    (@newshop)

    I also added some custom strings like p.e.:
    <?php _e( 'Delivery Date:', 'woocommerce-pdf-invoices-packing-slips' ); ?>
    but if I sync the template in Loco Translate, it doesnt add “Delivery Date:” to the list….

    • This reply was modified 7 years, 2 months ago by newshop.
    Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    It sounds like these are two separate issues.

    1) The “Payment Method” row in the totals comes from the woocommerce text domain – the data in this part of the PDF comes straight from WooCommerce. There’s another ‘payment method’ string that is from the ‘woocommerce-pdf-invoices-packing-slips’ text domain, but this is displayed in on the top of the document (below the order date). That is assuming you’re using the free “Simple” template.
    2) Loco Translate only scans the plugin folder, not the (child) theme where customizations would be made. If you’re customizing the template, adding custom strings, I recommend using the (child-)theme text domain instead. The plugin text domain is for core plugin strings only.

    Additionally, to avoid confusion over which text-domain is used, make sure that ‘Legacy mode’ is turned off under PDF Invoices > Status (naturally this also requires that your templates and custom filters are compatible with PDF Invoices 2.x). 1.x used the ‘wpo_wcpdf’ textdomain.

    Let us know if that helps!
    Ewout

    Thread Starter newshop

    (@newshop)

    Thanks Ewout!
    About 1): I dont find the string “Payment Method” in the woocommerce strings, only “Payment Method:” and “Payment Methods”. Same for “Shipping”. Can you please help me translating this string? I’ve turned Legacy mode off. Thank you.

    Plugin Contributor Ewout

    (@pomegranate)

    Just to make sure we’re talking about the same thing: could you take a screenshot of the PDF and mark which string you are referring to?
    Also, please double check that Legacy mode is still turned off – whenever you are still referring to the legacy functions, it will automatically turn back on, preventing fatal errors. There should be no references to $wpo_wcpdf anywhere in the template files or filters.

    Thread Starter newshop

    (@newshop)

    Youre right, legacy mode is turned on again. $wpo_wcpdf is used, how can I replace it?
    Please find a screenshot here of the strings in table footer I would like to translate:
    https://www.bilder-upload.eu/show.php?file=9ae820-1513349331.jpg

    many thanks in advance!

    Plugin Contributor Ewout

    (@pomegranate)

    Hi! This output looks quite different from the standard output from the Simple template, The Simple template actually does not show the Shipping Method title in the total row (it’s hidden with CSS) because it’s already shown on the top of the invoice. It also doesn’t show the taxes in separate rows, so either you or another plugin has modified these totals to come out the way they do now.

    TO remove all the $wpo_wcpdf references you can check the source of the Simple template that is bundled with the plugin. Most of it is just replacing $wpo_wcpdf with $this, but you can find more information in the deprecation notices in the PHP error logs and in this post under “No more global variables”.

    If all else fails, you can also just do a raw string replacement using this filter:

    
    add_filter('gettext', 'wpo_wcpdf_translate_zahlungsmethode', 10, 3 );
    function wpo_wcpdf_translate_zahlungsmethode( $translation, $text, $domain ) {
        if ( $translation == 'Zahlungsmethode' ) {
            $translation = 'Zahlung';
        }
        return $translation;
    }
    

    Hope that helps!
    Ewout

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Not translateable with Loco Translate’ is closed to new replies.