| @@ -1,8 +1,5 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * @package Polylang | |
| 4 | - */ | |
| 5 | 2 | |
| 6 | 3 | /** |
| 7 | 4 | * It is best practice that plugins do nothing before plugins_loaded is fired |
| 8 | 5 | * so it is what Polylang intends to do |
| @@ -12,9 +9,9 @@ | ||
| 12 | 9 | * |
| 13 | 10 | * @since 1.2 |
| 14 | 11 | */ |
| 15 | 12 | class PLL_OLT_Manager { |
| 16 | - protected static $instance; // For singleton | |
| 13 | + static protected $instance; // For singleton | |
| 17 | 14 | protected $default_locale; |
| 18 | 15 | protected $list_textdomains = array(); // All text domains |
| 19 | 16 | public $labels = array(); // Post types and taxonomies labels to translate |
| 20 | 17 | |
| @@ -76,14 +73,13 @@ | ||
| 76 | 73 | |
| 77 | 74 | // Don't try to save time for en_US as some users have theme written in another language |
| 78 | 75 | // Now we can load all overridden text domains with the right language |
| 79 | 76 | if ( ! empty( $this->list_textdomains ) ) { |
| 80 | - /* | |
| 81 | - * FIXME: Backward compatibility with WP < 5.6 | |
| 82 | - * From WP 4.7 to 5.5, we need to reset the internal cache of _get_path_to_translation when switching from any locale to en_US. | |
| 83 | - * See WP_Locale_Switcher::change_locale() | |
| 84 | - */ | |
| 85 | - if ( ! class_exists( 'WP_Textdomain_Registry' ) && function_exists( '_get_path_to_translation' ) ) { | |
| 77 | + | |
| 78 | + // Since WP 4.7 we need to reset the internal cache of _get_path_to_translation when switching from any locale to en_US | |
| 79 | + // See WP_Locale_Switcher::change_locale() | |
| 80 | + // FIXME test _get_path_to_translation for backward compatibility with WP < 4.7 | |
| 81 | + if ( function_exists( '_get_path_to_translation' ) ) { | |
| 86 | 82 | _get_path_to_translation( null, true ); |
| 87 | 83 | } |
| 88 | 84 | |
| 89 | 85 | foreach ( $this->list_textdomains as $textdomain ) { |
| @@ -139,16 +135,18 @@ | ||
| 139 | 135 | } |
| 140 | 136 | |
| 141 | 137 | /** |
| 142 | 138 | * FIXME: Backward compatibility with Polylang for WooCommerce < 0.3.4 |
| 143 | - * Was formerly hooked to the filter 'override_load_textdomain' | |
| 139 | + * To remove in Polylang 2.1 | |
| 144 | 140 | * |
| 145 | 141 | * @since 0.1 |
| 146 | 142 | * |
| 147 | - * @param bool $bool Whether to override the .mo file loading. | |
| 143 | + * @param bool $bool not used | |
| 144 | + * @param string $domain text domain name | |
| 145 | + * @param string $mofile translation file name | |
| 148 | 146 | * @return bool |
| 149 | 147 | */ |
| 150 | - public function mofile( $bool ) { | |
| 148 | + public function mofile( $bool, $domain, $mofile ) { | |
| 151 | 149 | return $bool; |
| 152 | 150 | } |
| 153 | 151 | |
| 154 | 152 | /** |