How to translate the words in Tax Toggle?

Tax Toggle makes it easy to translate the core words of the Tax Toggle button to suit your sites language, and it is also compatible with many of the leading multilingual plugins for WordPress.

There are four core ways to translate the words in Tax Toggle:

1) You can set some of the words from the Plugin settings - go to WooCommerce > Settings > Tax and then at the bottom of the page you will see Tax Toggle settings. You can quickly and easily update the word for "Inclusive" or "Exclusive" and your local word for 'Tax" (i.e. VAT).

2) You can also add code to your themes function.php file to translate words, using the WordPress function gettext(). For example:

  * Change text strings for WooCommerce Tax Toggle
  * This will translate the text used in Tax Toggle plugin.
  * This code should be copied to you themes functions.php file
  * @param string $translated_text Translated text.
  * @param string $text Text to translate.
  * @param string $domain Text domain. Unique identifier for retrieving translated strings.
function wctax_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Excl.':
$translated_text = __( 'Exkl', 'wc-tax' );
case 'From':
$translated_text = __( 'Von', 'wc-tax' );
case 'Incl.':
$translated_text = __( 'Inkl', 'wc-tax' );
case 'No Tax':
$translated_text = __( '(Zero Tax)', 'wc-tax' );
return $translated_text;
add_filter( 'gettext', 'wctax_text_strings', 20, 3 );

In this example several words have been translated. For instance any use of the word "From" in Tax Toggle will be replaced by "Von". You can use this gettext() method to translate or even replace words - for instance "No Tax" could be replaced for example with "Zero Tax" depending on your preference.

3) If using gettext, functions and editing your theme file seems too difficult, you could use a plugin to help you translate strings from your themes and plugins - a popular free plugin is Loco Translate but there are many other translation/word change plugins. 

Here is a video (not our content showing how to translate plugin text using Loco Translate:

4) Finally, the plugin since Version 1.3.5 is fully translatable using a WordPress translation file. This is the quickest and most performant way of translating plugins and themes. You can add your own custom translation file to your theme and this will take priority other the language used in the plugin.

Here are some videos to show the gist of performing the translation (not our content):

Article Details

Article ID:
Rating :