How to translate the words in Tax Toggle?

Tax Toggle is compatible with many of the leading multilingual plugins for WordPress.

You can set some of the words from the Plugin settings, and the other strings can be translated using gettext function. Here is an example function for you to add to your functions.php file:

  * Change text strings for WooCommerce Tax Toggle
  * Translate the text used in Tax Toggle plugin.
  * Copy the code below to your theme 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 );

If this seems too complicated, there are many plugins you can use to translate your theme and plugins text. A popular free plugin is Loco Translate

Article Details

Article ID:
Rating :