• Resolved bagendahl

    (@bagendahl)


    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

    (@wijnbergdevelopments)

    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

    (@bagendahl)

    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:

    $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

    (@wdevs)

    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

    (@bagendahl)

    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

    (@wdevs)

    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.
    Thread Starter bagendahl

    (@bagendahl)

    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

    (@wdevs)

    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.