Support » Plugin: Stock Locations for WooCommerce » Add translation strings for stock on product page

  • Resolved stalstadens

    (@henriksstalstadens)


    Hi.

    Translation strings is missing so you can’t translate stock status on product page.
    You can fix this by replacing woocommerce with stock-locations-for-woocommerce in inc/functions.php
    row 728
    $availability = __( 'Out of stock.', 'stock-locations-for-woocommerce' );
    row 732
    $availability = __( $stock . ' in stock.', 'stock-locations-for-woocommerce' );

    and add these lines to languages/stock-locations-for-woocommerce.pot

    #: ../../../../../stock-locations-for-woocommerce/src/inc/functions.php:728
    msgid "Out of stock."
    msgstr ""
    
    #: ../../../../../stock-locations-for-woocommerce/src/inc/functions.php:732
    msgid " in stock."
    msgstr ""

    Perhaps you have a better solution, but I hope you get the point.

    • This topic was modified 1 month, 1 week ago by stalstadens. Reason: formatting
    • This topic was modified 1 month, 1 week ago by stalstadens. Reason: formatting again
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter stalstadens

    (@henriksstalstadens)

    My bad.
    You also need to change order in code at row 732
    $availability = __( $stock . ' in stock.', 'stock-locations-for-woocommerce' );
    with
    $availability = $stock . __( ' in stock.', 'stock-locations-for-woocommerce' );

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @henriksstalstadens thank you so much. You will get it in next version. Actually these strings were taken from core WC earlier but later get modified so I forgot to add the plugin text domain particularly.

    Thread Starter stalstadens

    (@henriksstalstadens)

    Thanks for implementing this.

    However you still need to change row 755 from;

    $availability = __( $stock . ' in stock.', 'stock-locations-for-woocommerce' );

    to

    $availability = $stock . __( ' in stock.', 'stock-locations-for-woocommerce' );

    in order to get this to work with translations.

    BR,
    Henrik

    • This reply was modified 3 weeks, 4 days ago by stalstadens.
    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @henriksstalstadens please get the latest version with this fix.

    Thread Starter stalstadens

    (@henriksstalstadens)

    You are amazing <3

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @henriksstalstadens have you already written a nice review?

    Thread Starter stalstadens

    (@henriksstalstadens)

    I have done it already 🙂

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