The plugin is just a regular WooCommerce shipping method. So, if Polylang can translate shipping options’ titles it would be also able to translate WBS shipping options. WPML, for example, has a function called ‘String Translation’ suitable for that.
thanks for your quick reply. Polylang has similar string translation feature, but the shipping options’ titles do not seem to appear in the list of strings. Would it be possible to add support for translation? Please see Polylang documentation for reference; it is quite easy to register strings to be translated.
The issue is that it’s not the right way to do things. I’ll try to explain this.
There are a lot of plugins people use with WooCommerce and Weight Based Shipping and Polylang is just another one. Ad-hoc integration with each of them would bloat WBS code making it more difficult to develop and support.
On other hand, there are a lot of shipping plugins available for WooCommerce and WBS is just another one. It seems we’ll never see every shipping plugin to have an ad-hoc integration with Polylang.
I see no reason why Polylang doesn’t support shipping options’ titles out of the box. WooCommerce provides all the necessary information for that. We can see how WPML does it.
I believe a better place to ask the feature is Polylang itself. Most likely they have the feature in their backlog or even are already working on it. By the way, it would be great if you let us know their answer in case you decide to contact them with this feature request.
thanks for your thorough reply and explanation. I understand it is not feasible to support integration for several different translation plugins.
I will submit a feature request to Polylang to find out more. I’ll let you know how it goes.
Is it possible to hook into the shipping method titles, to register strings for translation programmatically myself, and then return the translated strings?
I believe it’s possible if you have some coding skills.
I got the instructions from Polylang support. They have support for WPML config files, and a appropriately formatted config file makes it possible to translate the WBS shipping titles and labels.
Thanks for your help on finding the answer!
Glad to hear you have found a way to solve it. Thank you for the update.
were you able to do it? I have the same problem and I don’t really understand what to do. Could you explain how did you do it?
yes, I was able to do the translations. Just create a new folder called
wp-contentfolder, and create a file called
wpml-config.xmlin there, with contents below.
<wpml-config> <admin-texts> <key name="wbs_config"> <key name="rules" > <key name="0" > <key name="meta" > <key name="title" /> <key name="label" /> </key> </key> <key name="1" > <key name="meta" > <key name="title" /> <key name="label" /> </key> </key> <key name="2" > <key name="meta" > <key name="title" /> <key name="label" /> </key> </key> </key> </key> </admin-texts> </wpml-config>
The file is built for three shipping rules. If you need to add more, just duplicate those
key name="x"nodes and number them accordingly.
After this, you should see the shipping titles as translatable under your Polylang’s string translation menu in wp-admin.
- The topic ‘Translating titles with Polylang’ is closed to new replies.