• Resolved Soft79

    (@josk79)


    Hi,

    I’m using WP Multilang to translate my WooCommerce store and I noticed that all the strings of the EU-VAT-Assistant-plugin are displayed in the site’s default language, no matter what language the current page is in.

    After some debugging I noticed that the EU-VAT-Assistant-plugin uses gettext functions (like __() ) before the language is initialized by WP Multilang, which does this at action ‘init’, priority 0.

    If the EU-VAT-Assistant-plugin would handle it’s initializing at the ‘init’-action, the problem is solved. Like this:

    At the end of plugin-main.php:

    add_action( 'init', function() {
    	$GLOBALS[WC_Aelia_EU_VAT_Assistant::$plugin_slug] = WC_Aelia_EU_VAT_Assistant::factory();
    });

    Can this please be implemented in the next release?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Soft79

    (@josk79)

    A small (ugly) fix, because some initialisation is done by Aelia in woocommerce_init:

    
    add_action( 'init', function() {
      $GLOBALS[WC_Aelia_EU_VAT_Assistant::$plugin_slug] = WC_Aelia_EU_VAT_Assistant::factory();
      if ( did_action('woocommerce_init') ) $GLOBALS[WC_Aelia_EU_VAT_Assistant::$plugin_slug]->woocommerce_loaded();
    });
    
    Plugin Author Diego

    (@daigo75)

    Hi Soft79,
    Thanks for your feedback. The plugin has to be initialised when the plugin file is loaded, as it’s done now, not on the init event.

    All of our plugins are based on a mini-framework we developed, and they all follow the same logic to initialise themselves, which works with most multilanguage plugins. Also, the EU VAT Assistant, as well as all our other plugins, also need to perform actions before the init event is triggered.

    Unfortunately, we won’t be able to change the initialisation logic to accommodate WP Multilang. The workaround you propose could have unexpected side effects, and we can’t risk adopting it to support WP Multilang.

    My suggestion would be to apply the opposite workaround: the author of WP Multilang could update it so that the plugin is initialised when it’s loaded loaded by WordPress, before the init event (e.g. on plugins_loaded, or even earlier). That would ensure that the translation files are loaded correctly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Translations in wrong language’ is closed to new replies.