Translating Shipping options and Payment options
-
Hi again.
My store works in two languages. Everything works and translates normaly exept the Shipping and Payment options.
Any idea how to translate them?
-
Hello decarvalhoaa,
I have the same problem for translating Shipping and Payment Methods.
I’ve checked your code but I think I’m missing something.
Where do you store the translated strings? I mean that I can’t see those strings in Polylang String Translate section…Thank you for your help and best regards
Hi shearwater,
since I use the default WooCommerce Shipping and Payment Methods labels for all my languages I didn’t bother registering the strings for Translation in Polylang.
If your use case is different, you need to use pll_register_string function to the register the strings.
Optionally, if you want to pull the changes you made in the WooCommerce admin settings for your backoffice/default language, you could use the get_option function. Please note that get_option returns false if you have not change the default settings (nothing was saved to the database). Therefore, is a good idea to test the result and pass a default value to the get_option.Then you need to replace/change the line where I used __( $some_string ) with pll_().
I will try over the weekend to make the code snippet more generic.
Hello decarvalhoaa,
Thanks for your fast reply.
I’ll try to use the pll_register_string option. If I’ve understood correctly, it seems would be the right for me.
I will come back and report my findings.Best regards
I also have this issue. Would be great to get this code working ??
Thanks!I just finished a fix for Payment gateways and Shipment methods translations using Polylang’s string translation table. Right now only BACS and Paypal are done – still need to do Cheque and COD.
And didn’t had yet time to test it properly.The latest version can be downloaded here https://github.com/decarvalhoaa/woo-poly-integration/archive/master.zip
Can you check whether this would work for you?
I tried out your version of the plugin and it works. I use English and Spanish so after I changed the strings it works fine. I do have the text “Make your payment directly into…” double? And how do I go about changing the other payment options?
Where does the “Make your payment directly into…” text appears double and what are the steps to reproduce the issue?
For Cheque and COD only the translation of the instructions should missing. You can use the same pattern I used for BACS.
Since I don’t use these other gateways didn’t fix this yet. I have been busy with other priorities. But will try until the next weekend to get it working but will not have time to test it thoroughly.
I took some time to add support for Cheque and COD. Is not thoroughly tested. Please use it on a staging environment. Let me know if is working for you and I will include this in the master version.
https://github.com/decarvalhoaa/woo-poly-integration/archive/development.zip
Hello decarvalhoaa,
Sorry for not responding this weeks. I haven’t got time to test your development until today. For me it works like a charm! ??
Of course, I would include it in the master version.
If there is anything else that i can test, please let me know.Thank you very much for your time and efforts.
Best regards!
This changes have already been pushed to the master. I’m currently adding support for woocommerce 2.6 in my development branch. There were a few things broken with shipping zones, shipping classes and new cart ajax. But this is fixed now.
I recommend testing in a staging environment. i don’t recommend upgrading to WC 2.6 in production systems just now. There is still a great number of open issues and woothemes is working already on 2.6.2, and translations are not yet 100%. But I wanted to make sure users would have a working version if they have made the mistake to update production already.
If you decide to test it, let me know if something is broken.
By the way, I have baked in backward compatibility so users don’t need to upgrade all at the same time, to isolate problems more easily.
Hello decarvalhoaa,
I’ll stick on WC 2.5.5 for a while. Too much things affected (themes, plugins, etc) by now. When I’d upgrade, I will come back with my findings.
Thank you very much for supporting and continue developing this great plugin!
Best regards
Hello decarvalhoaa,
I tried your function above to translate the shipping methods and it worked but the shipping label itself is not translated.
We are using two languages English and Arabic. Everything is translated perfectly with the use of polylang + the regular .pot files and po edit. The only problem is with the label “shipping”, we have tried all the methods available but its not working. Can you offer us any help?Hi,
I didn’t understood if you have used the functions I posted above or did you used my fork in GitHub https://github.com/decarvalhoaa/woo-poly-integration/ ?
Since I posted the functions above, i found and fix a few problems. The version in the master branch in my github should work fine for you.
In case you are using WC 2.6, I have already implemented support for the new woocommerce versions but it still in beta testing in the development branch.
Thank you for the fast reply decarvalhoaa, I do have the plugin but I found a different way to achieve what I wanted, I did copied woocommerce/includes/wc-cart-functions.php from woocommerce plugin to inside mytheme/woocommerce/includes/wc-cart-functions.php then I changed the format of _n to __ then I changed the word from SHIPPING to DELIVERY. and then I just added in woocommerce-ar.po the word delivery and mentioned where it is used (inside wc-cart-functions.php:180) and everything worked magically ?? thank you for your fast reply again.
- The topic ‘Translating Shipping options and Payment options’ is closed to new replies.