Title: Language support in shortcode
Last modified: March 24, 2025

---

# Language support in shortcode

 *  Resolved [bagendahl](https://wordpress.org/support/users/bagendahl/)
 * (@bagendahl)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/)
 * The text inside button whene generate from shortcode does not have language support
   more than adding text in attribute. Is it possible to add support från language
   i18n file instead?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [wijnbergdevelopments](https://wordpress.org/support/users/wijnbergdevelopments/)
 * (@wijnbergdevelopments)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18379279)
 * Hello,
 * I believe I understand your question. Would it be helpful if I added translation
   functionality to the text labels? It could look something like this:
 * `$attributes['switch-label-incl'] = ( $attributes['switch-label-incl'], 'tax-
   switch-for-woocommerce' ); `
   `$attributes['switch-label-excl'] = ( $attributes['
   switch-label-excl'], 'tax-switch-for-woocommerce' );`
 * This change would allow the text in the labels to be translated based on the 
   translations in your i18n files.
 * Let me know if this would help. I can publish an update relatively quick.
 *  Thread Starter [bagendahl](https://wordpress.org/support/users/bagendahl/)
 * (@bagendahl)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18379661)
 * Hi,
 * Thank you for your quick response and for understanding the core of the issue.
 * Apologies for the brief explanation in my original message. You interpreted it
   correctly — the main problem arises when using the shortcode to render the tax
   switch buttons. In that case, the text labels do not currently support translations
   via the standard i18n mechanism. Instead, they either default to the English 
   text or rely solely on what’s passed via shortcode attributes.
 * However, when the buttons are displayed on the product pages (outside of the 
   shortcode context), the translations from the i18n files work perfectly as expected.
   Since our site is multilingual, this inconsistency causes issues with localization
   for users viewing the site in other languages.
 * The solution you suggested — adding translation support for the shortcode label
   attributes using something like:
 *     ```wp-block-code
       $attributes['switch-label-incl'] = __( $attributes['switch-label-incl'], 'tax-switch-for-woocommerce' );$attributes['switch-label-excl'] = __( $attributes['switch-label-excl'], 'tax-switch-for-woocommerce' );
       ```
   
 * — sounds great and would solve the problem by allowing the labels to pull from
   translation files if available. This would ensure consistency across all languages
   and usage contexts, including those generated by the shortcode.
 * Please go ahead with the update — it would be highly appreciated!
 * Best regards,
   Patrick
 *  Plugin Support [wdevs](https://wordpress.org/support/users/wdevs/)
 * (@wdevs)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18381948)
 * Hello Patrick,
 * I’m sorry. I don’t know why but I can’t reply anymore with my default WordPress
   developer account.
 * A new update has been released today which should fix your issue (I have also
   sent you an email this morning about this btw 🙂 )
 * Could you please try it out and report back to me? Thanks!
 *  Thread Starter [bagendahl](https://wordpress.org/support/users/bagendahl/)
 * (@bagendahl)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18382269)
 * Hi,
 * Thank you for pushing the update!
 * However, after testing the latest version, it seems that the labels for “including”
   and “excluding” tax are no longer showing by default unless I manually enter 
   a value in the plugin settings. This wasn’t the case before, and it now requires
   me to add custom text for both labels in the settings page. The problem with 
   that is the text I enter is then static and only shown in the language I write
   it in, which doesn’t work well for multilingual sites.
 * As for the shortcode and the buttons, they still seem to only show English text
   by default unless I override the label using shortcode attributes. This means
   we still don’t get the dynamic translations from the i18n files, which was the
   original issue I was hoping to solve.
 * To summarize:
    - The default labels don’t show at all unless manually entered in settings.
    - When entered manually, the labels don’t support translation.
    - Shortcode-based buttons still don’t pick up translated labels from the i18n
      files.
 * Let me know if there’s anything else I can help test or clarify — and thanks 
   again for your quick support on this!
 * Best regards,
   Patrick
 *  Plugin Support [wdevs](https://wordpress.org/support/users/wdevs/)
 * (@wdevs)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18382683)
 * That’s strange, only a couple of lines of code were changed. Which multi language
   plugin are you using?
    -  This reply was modified 1 year, 2 months ago by [wdevs](https://wordpress.org/support/users/wdevs/).
 *  Thread Starter [bagendahl](https://wordpress.org/support/users/bagendahl/)
 * (@bagendahl)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18382916)
 * Sorry for my previous question. I learned that the customer uses gTranslate instead
   of a real translation plugin. So, when I added the text into settings and shortcode(
   ex vat, ink vat) it worked as it should. Thanks for the update and your quick
   response.
 *  Plugin Support [wdevs](https://wordpress.org/support/users/wdevs/)
 * (@wdevs)
 * [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18382918)
 * No problem, happy to hear it’s working for you! I will close this topic now if
   you don’t mind. Cheers!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Language support in shortcode’ is closed to new replies.

 * ![](https://ps.w.org/tax-switch-for-woocommerce/assets/icon-256x256.png?rev=3368488)
 * [Tax Switch for WooCommerce](https://wordpress.org/plugins/tax-switch-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tax-switch-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tax-switch-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/tax-switch-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tax-switch-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tax-switch-for-woocommerce/reviews/)

 * 7 replies
 * 3 participants
 * Last reply from: [wdevs](https://wordpress.org/support/users/wdevs/)
 * Last activity: [1 year, 2 months ago](https://wordpress.org/support/topic/language-support-in-shortcode/#post-18382918)
 * Status: resolved