Skip to content Skip to sidebar

Resolved by author

Topic Tags: Compatibility

Overview of the issue

When using HUSKY – Products Filter Professional for WooCommerce with WPML, the “Open” and “Close” button texts for the mobile version cannot be translated using the standard WPML string translation methods.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

Step 1: Make Admin Strings Translatable

  • Go to WPML > Settings > Custom XML Configuration
  • Paste the following code into the Custom XML Configuration field and click “Save”:
    <wpml-config>
      <admin-texts>
        <key name="woof_settings">
          <key name="text_mobile_behavior_open" />
          <key name="text_mobile_behavior_close" />
        </key>
      </admin-texts>
    </wpml-config>
    
  • Go to WPML > String Translation and translate both strings [woof_settings]text_mobile_behavior_open and [woof_settings]text_mobile_behavior_close

Step 2: Modify Plugin Code

  • Open /wp-content/plugins/woocommerce-products-filter/views/woof.php
  • Look for line 545
  • Replace:
    $text_mb_open = (isset($this->settings['text_mobile_behavior_open'])) ? $this->settings['text_mobile_behavior_open'] : esc_html__('Open filter', 'woocommerce-products-filter');
    $text_mb_close = (isset($this->settings['text_mobile_behavior_close'])) ? $this->settings['text_mobile_behavior_close'] : esc_html__('Close filter', 'woocommerce-products-filter');
    
  • With:
    $text_mb_open = (isset($this->settings['text_mobile_behavior_open'])) ? esc_html__($this->settings['text_mobile_behavior_open'], 'admin_texts_woof_settings') : esc_html__('Open filter', 'woocommerce-products-filter');
    $text_mb_close = (isset($this->settings['text_mobile_behavior_close'])) ? esc_html__($this->settings['text_mobile_behavior_close'], 'admin_texts_woof_settings') : esc_html__('Close filter', 'woocommerce-products-filter');