Support » Plugin: Language Fallback » Allow other plugins to manipulate registered filters and actions

  • We are trying to resolve the missing integration with the plugin english-wp-admin.

    That plugin (and possibly others) are forcing the interface language in the backend to be English. However, when it does, then the language-fallback plugin still loads the second language as a fallback, which in turn causes the administrative dashboard to not appear in English.

    In order to resolve this, the english-wp-admin plugin needs to unregister the locale filter of language-fallback in the right conditions. However, it is not able to do that currently, because the language-fallback plugin does not retain the class instance (object) that was used to register the filter.

Viewing 1 replies (of 1 total)
  • Thread Starter sun


    The following patch resolves the issue by giving other code access to the class instance. It would be great if you could include this change in the next release.

    diff --git a/language-fallback.php b/language-fallback.php
    index bf363a1..7b7d27d 100644
    --- a/language-fallback.php
    +++ b/language-fallback.php
    @@ -13,6 +13,8 @@
     class Language_Fallback {
    +       private static = $instance;
             * used to store the current locale e.g. "de_DE"
    @@ -28,6 +30,7 @@ class Language_Fallback {
            private $fallback_locale;
            function __construct() {
    +               self::$instance = $this;
                    // get current locale
                    $this->locale = get_locale();
    @@ -48,6 +51,13 @@ class Language_Fallback {
                    load_plugin_textdomain( 'language-fallback', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    +       public static function getInstance() {
    +               if (!isset(self::$instance)) {
    +                       new self();
    +               }
    +               return self::$instance;
    +       }
             * A function to check if the requested mofile exists and if not, it checks if a mofile for the fallback locale exists
    • This reply was modified 5 years, 4 months ago by sun. Reason: Removed windows line ending markers from diff
Viewing 1 replies (of 1 total)
  • The topic ‘Allow other plugins to manipulate registered filters and actions’ is closed to new replies.