• Resolved Mikko Siikaniemi

    (@mikrogramma)


    Hi there, thanks for the great plugin.

    Is it possible to translate the package rule titles customer sees at checkout with Polylang or similar?

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Dan

    (@dangoodman)

    Hi,

    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.

    Thread Starter Mikko Siikaniemi

    (@mikrogramma)

    Hi Dan,

    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.

    Plugin Author Dan

    (@dangoodman)

    Hi Mikko,

    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.

    • This reply was modified 5 years, 9 months ago by Dan.
    • This reply was modified 5 years, 9 months ago by Dan.
    Thread Starter Mikko Siikaniemi

    (@mikrogramma)

    Hi Dan,

    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?

    Plugin Author Dan

    (@dangoodman)

    Hi Miko,

    I believe it’s possible if you have some coding skills.

    Thread Starter Mikko Siikaniemi

    (@mikrogramma)

    Hi Dan,

    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!

    Plugin Author Dan

    (@dangoodman)

    Glad to hear you have found a way to solve it. Thank you for the update.

    Hi Mikko,
    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?
    Thanks!

    Thread Starter Mikko Siikaniemi

    (@mikrogramma)

    Hi beatrris,

    yes, I was able to do the translations. Just create a new folder called polylang under wp-content folder, and create a file called wpml-config.xml in 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.

    Thank you very much, it’s working perfectly!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Translating titles with Polylang’ is closed to new replies.