fbpx

[wcj_wpml]

Translate any text

Description

[wcj_wpml] shortcode translates any text to language set by WPML.
* WPML plugin must be installed.

Args

lang
(optional) Language code (as in WPML) to display current shortcode content. Can be comma separated list.

Default: None
not_lang
(optional) Language code (as in WPML) not to display current shortcode content. Can be comma separated list.

Default: None

Examples

[wcj_wpml lang="DE"]Guten Tag![/wcj_wpml]
[wcj_wpml lang="EN"]Good day![/wcj_wpml]
[wcj_wpml not_lang="DE,EN"]Hi![/wcj_wpml]
If the example above won’t work, please try replacing `lang` attribute’s values with lowercase, i.e. `EN` to `en`, and `DE` to `de`.
Accessible through:
  • [wcj_wpml]
Tested on WooCommerce 4.2.0 and WordPress 5.4.2
Plugin can be downloaded here. If there are any locked fields in the module, you will need to get Booster Plus to unlock them.

Leave a Reply

Comments

14 Comments

  1. Kristian Lautrup April 22, 2020 at 6:42 pm #

    Hi,
    I’m testing Booster to consider whether I want to by the premium plugin.

    I can’t get wcj_wpml to ensure correct language for all the email triggers.
    For instance if I put this code in the ‘HTML template’ field and select trigger ‘Order status updated to completed’:

    [wcj_wpml lang="en"]English[/wcj_wpml]
    [wcj_wpml lang="da"]Dansk[/wcj_wpml]

    It always returns “English” also if I finish the Checkout using da (Danish) language.

    Looking at the ‘Edit order’ record it confirms that wpml_language is “da”, but still when completing it the sent email matches:

    [wcj_wpml lang="en"]English[/wcj_wpml_translate]

    I also tried with wcj_wpml_translate with same result.

    And wcj_wpml lang=”EN” (capital letters) returns an empty email body.

    Regards,
    Kristian

    Reply to thread

    Avatar
    • RokasJ April 23, 2020 at 4:57 am #

      Hi Kristian,

      Do you have enabled “Booster WPML” module?

      Also sometimes some problems with WPML could be solved regenerating wpml-config.xml file. It could be done via WooCommerce > Settings > Booster > Emails & Misc. > WPML. Tick enable module checkbox, save settings and press Regenerate wpml-config.xml file.

      If this doesn’t help contact us directly at [email protected]

      Best regards,
      Rokas – Support team

      Avatar
  2. Stan September 6, 2019 at 11:14 am #

    Hey guys!
    I am trying to use this shortcode on the “Shipping Descriptions” module. Which seems to work fine for a split second after reloading the page then for some reason it decides to show the shortcode with the other languages. Any ideas of what I am doing wrong? I have tried with both uppercase and lowercase.
    Thanks for reading me!
    Best regards,
    Stan

    Reply to thread

    Avatar
    • RokasJ September 6, 2019 at 2:35 pm #

      Hi Stan,

      Does WPML work in other parts of the website? What about this shortcode elsewhere?

      If you are using any caching plugins I would suggest trying to set “Default customer location” to “Geolocate (with page caching support)” in Woocommerce Settings > General.

      Best regards,
      Rokas – Support Team

      Avatar
    • Stan September 8, 2019 at 9:53 am #

      Hey Rokas !
      Thanks so much for the reply! Well it seems to work on the cart page now in 2 different languages it just doesn’t work on the checkout page. I am currently not using any caching plugins on this site. Any other ideas I can try out?

      Thanks again!
      Stan

      Avatar
    • Stan September 8, 2019 at 12:33 pm #

      One extra note, I also use the left to free shipping module in combination with this same shortcode. And that one does work on both cart and checkout in both languages. And as said it does seem to work for a split second but once the “checkout” finishes loading it shows the shortcodes.

      Hope this will help find the issue.
      Best regards,
      Stan

      Avatar
    • RokasJ September 8, 2019 at 2:20 pm #

      Hi Stan,

      Could you contact us directly via email [email protected] about this issue?

      Best regards,
      Rokas – Support Team

      Avatar
  3. Marc June 26, 2018 at 4:18 pm #

    Hi, I’m not an experienced with shortcodes or how to use them, so I’ll appreciate if you can give me a more detailed example on how to use the WPML shortcode on a site with 2 languages. The part I want to use WPML with is the (Offer Your Price) and the lightbox contact form.
    I was trying to use the strings in WPML to translate those parts but it doesn’t work.

    Please explain, thanks.

    Reply to thread

    Avatar
  4. awag September 17, 2017 at 11:09 pm #

    Hi,
    I need to translate verification email sent.
    I tried to put in the settings / Message – Success :
    [wcj_wpml lang="EN"]Guten Tag!Success: Your account has been activated![/wcj_wpml]
    [wcj_wpml lang="FR"]Merci ! Votre compte est maintenant bien activé ![/wcj_wpml]

    but it is not working . any idea please ?

    Reply to thread

    Avatar
    • awag September 17, 2017 at 11:28 pm #

      Ok I found the trick : put lowercase [wcj_wpml lang="en"] instead of [wcj_wpml lang="EN"] !

      Avatar
  5. Jean-Marc December 22, 2016 at 10:20 am #

    Hi, I tried [wcj_wpml lang="EN"]Warranty Policy[/wcj_wpml] [wcj_wpml lang="FR"]Warranty Policy[/wcj_wpml] with the Product Tabs Module Title but it doesn’t work.

    Reply to thread

    Avatar
    • Booster Support Team December 22, 2016 at 9:43 pm #

      Hi Jean-Marc,

      I’ve just rechecked the code – it should work as you described. What results are you getting? Empty title? And if possible, please contact me on [email protected] with server login details, so I could check it out by myself.

      Best regards,
      Tom

      Booster Support Team
  6. Robert September 2, 2015 at 7:40 pm #

    Hi, I’m not an experienced with shortcodes, so I’ll apreciate if you can give me a more detailed example on how to use the wpml shortcode on a site with 3 languages.

    Thanks!

    Reply to thread

    Avatar
    • Valentin Solovjov September 4, 2015 at 7:57 pm #

      Dear Robert,

      what part of site do you want to use wpml ?

      BR,
      Val

      Avatar