flagshipcompany / flagship-for-woocommerce

MIT License
7 stars 3 forks source link

Lack of translations #71

Open atoupet-toki opened 3 years ago

atoupet-toki commented 3 years ago

Hi guys! Would be awesome if rendered text in woocommerce cart could be translated :)

https://github.com/flagshipcompany/flagship-for-woocommerce/blob/58c0cc94b06a629b39630633ebcc816ae1409422/src/Components/Shipping/RateProcessor/NativeRateProcessor.php#L73

radua commented 3 years ago

Fixed in v3.0.5

atoupet-toki commented 3 years ago

Thanks guys! But ... I don't think a translation with a variable doesn't work like that! Did you guys get it workin?

atoupet-toki commented 3 years ago

Ok, got it:

$transitDaysText = $transitTime . ' ' . _n('day', 'days', $transitTime , FLAGSHIP_SHIPPING_TEXT_DOMAIN); $text = sprintf(__(' (Time in transit %s) ', FLAGSHIP_SHIPPING_TEXT_DOMAIN), $transitDaysText);

You have to manage plural in your .po ti get something like this: "Plural-Forms: nplurals=2; plural=(n > 1);\n"

#: src/Components/Shipping/RateProcessor/NativeRateProcessor.php:71
msgid "day"
msgid_plural "days"
msgstr[0] "jour"
msgstr[1] "jours"

#: src/Components/Shipping/RateProcessor/NativeRateProcessor.php:72
#, php-format
msgid " (Time in transit %s) "
msgstr " (Temps de transit %s) "

Hope you'll get into it before next release :)

ricardo-fls commented 3 years ago

This is not fixed yet. https://github.com/flagshipcompany/flagship-for-woocommerce/blob/v3.0.x/src/Components/Shipping/RateProcessor/NativeRateProcessor.php#L72

Go with Atoupet's suggestion. Even if you don't implement the plurals.