Version Description
(2016-12-19) =
- Fix plugin not loaded first (introduced in 2.0.11)
- Fix wrong translations files loaded when the language is set from the content in WP 4.7 #76
- Fix notice when a tax query has no terms (using EXISTS or NOT EXISTS)
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 2.0.12 |
Comparing to | |
See all releases |
Code changes from version 2.0.11 to 2.0.12
- frontend/frontend-auto-translate.php +1 -1
- include/class-polylang.php +2 -3
- include/olt-manager.php +19 -3
- polylang.php +2 -2
- readme.txt +7 -1
frontend/frontend-auto-translate.php
CHANGED
@@ -215,7 +215,7 @@ class PLL_Frontend_Auto_Translate {
|
|
215 |
*/
|
216 |
protected function translate_tax_query_recursive( $tax_queries ) {
|
217 |
foreach ( $tax_queries as $key => $q ) {
|
218 |
-
if ( isset( $q['taxonomy'] ) && $this->model->is_translated_taxonomy( $q['taxonomy'] ) ) {
|
219 |
$arr = array();
|
220 |
$field = isset( $q['field'] ) && in_array( $q['field'], array( 'slug', 'name' ) ) ? $q['field'] : 'term_id';
|
221 |
foreach ( (array) $q['terms'] as $t ) {
|
215 |
*/
|
216 |
protected function translate_tax_query_recursive( $tax_queries ) {
|
217 |
foreach ( $tax_queries as $key => $q ) {
|
218 |
+
if ( isset( $q['taxonomy'], $q['terms'] ) && $this->model->is_translated_taxonomy( $q['taxonomy'] ) ) {
|
219 |
$arr = array();
|
220 |
$field = isset( $q['field'] ) && in_array( $q['field'], array( 'slug', 'name' ) ) ? $q['field'] : 'term_id';
|
221 |
foreach ( (array) $q['terms'] as $t ) {
|
include/class-polylang.php
CHANGED
@@ -41,10 +41,9 @@ class Polylang {
|
|
41 |
// take no action before all plugins are loaded
|
42 |
add_action( 'plugins_loaded', array( $this, 'init' ), 1 );
|
43 |
|
44 |
-
// override load text domain waiting for the language to be defined
|
45 |
// here for plugins which load text domain as soon as loaded :(
|
46 |
-
|
47 |
-
if ( ( ! defined( 'PLL_OLT' ) || PLL_OLT ) && ! ( is_admin() && function_exists( 'get_user_locale' ) ) ) {
|
48 |
PLL_OLT_Manager::instance();
|
49 |
}
|
50 |
|
41 |
// take no action before all plugins are loaded
|
42 |
add_action( 'plugins_loaded', array( $this, 'init' ), 1 );
|
43 |
|
44 |
+
// override load text domain waiting for the language to be defined
|
45 |
// here for plugins which load text domain as soon as loaded :(
|
46 |
+
if ( ! defined( 'PLL_OLT' ) || PLL_OLT ) {
|
|
|
47 |
PLL_OLT_Manager::instance();
|
48 |
}
|
49 |
|
include/olt-manager.php
CHANGED
@@ -21,6 +21,16 @@ class PLL_OLT_Manager {
|
|
21 |
* @since 1.2
|
22 |
*/
|
23 |
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
// Saves the default locale before we start any language manipulation
|
25 |
$this->default_locale = get_locale();
|
26 |
|
@@ -33,9 +43,6 @@ class PLL_OLT_Manager {
|
|
33 |
add_action( 'pll_language_defined', array( $this, 'load_textdomains' ), 2 ); // After PLL_Frontend::pll_language_defined
|
34 |
add_action( 'pll_no_language_defined', array( $this, 'load_textdomains' ) );
|
35 |
|
36 |
-
// Allows Polylang to be the first plugin loaded ;-)
|
37 |
-
add_filter( 'pre_update_option_active_plugins', array( $this, 'make_polylang_first' ) );
|
38 |
-
add_filter( 'pre_update_option_active_sitewide_plugins', array( $this, 'make_polylang_first' ) );
|
39 |
}
|
40 |
|
41 |
/**
|
@@ -65,9 +72,18 @@ class PLL_OLT_Manager {
|
|
65 |
remove_filter( 'gettext_with_context', array( $this, 'gettext_with_context' ), 10, 4 );
|
66 |
$new_locale = get_locale();
|
67 |
|
|
|
68 |
// Don't try to save time for en_US as some users have theme written in another language
|
69 |
// Now we can load all overriden text domains with the right language
|
70 |
if ( ! empty( $this->list_textdomains ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
foreach ( $this->list_textdomains as $textdomain ) {
|
72 |
// Since WP 4.6, plugins translations are first loaded from wp-content/languages
|
73 |
if ( ! load_textdomain( $textdomain['domain'], str_replace( "{$this->default_locale}.mo", "$new_locale.mo", $textdomain['mo'] ) ) ) {
|
21 |
* @since 1.2
|
22 |
*/
|
23 |
public function __construct() {
|
24 |
+
// Allows Polylang to be the first plugin loaded ;-)
|
25 |
+
add_filter( 'pre_update_option_active_plugins', array( $this, 'make_polylang_first' ) );
|
26 |
+
add_filter( 'pre_update_option_active_sitewide_plugins', array( $this, 'make_polylang_first' ) );
|
27 |
+
|
28 |
+
// Overriding load text domain only on front since WP 4.7
|
29 |
+
// FIXME test get_user_locale for backward compatibility with WP < 4.7
|
30 |
+
if ( is_admin() && function_exists( 'get_user_locale' ) ) {
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
// Saves the default locale before we start any language manipulation
|
35 |
$this->default_locale = get_locale();
|
36 |
|
43 |
add_action( 'pll_language_defined', array( $this, 'load_textdomains' ), 2 ); // After PLL_Frontend::pll_language_defined
|
44 |
add_action( 'pll_no_language_defined', array( $this, 'load_textdomains' ) );
|
45 |
|
|
|
|
|
|
|
46 |
}
|
47 |
|
48 |
/**
|
72 |
remove_filter( 'gettext_with_context', array( $this, 'gettext_with_context' ), 10, 4 );
|
73 |
$new_locale = get_locale();
|
74 |
|
75 |
+
|
76 |
// Don't try to save time for en_US as some users have theme written in another language
|
77 |
// Now we can load all overriden text domains with the right language
|
78 |
if ( ! empty( $this->list_textdomains ) ) {
|
79 |
+
|
80 |
+
// Since WP 4.7 we need to reset the internal cache of _get_path_to_translation when switching from any locale to en_US
|
81 |
+
// See WP_Locale_Switcher::changle_locale()
|
82 |
+
// FIXME test _get_path_to_translation for backward compatibility with WP < 4.7
|
83 |
+
if ( function_exists( '_get_path_to_translation' ) ) {
|
84 |
+
_get_path_to_translation( null, true );
|
85 |
+
}
|
86 |
+
|
87 |
foreach ( $this->list_textdomains as $textdomain ) {
|
88 |
// Since WP 4.6, plugins translations are first loaded from wp-content/languages
|
89 |
if ( ! load_textdomain( $textdomain['domain'], str_replace( "{$this->default_locale}.mo", "$new_locale.mo", $textdomain['mo'] ) ) ) {
|
polylang.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: Polylang
|
5 |
Plugin URI: https://polylang.pro
|
6 |
-
Version: 2.0.
|
7 |
Author: Frédéric Demarle
|
8 |
Author uri: https://polylang.pro
|
9 |
Description: Adds multilingual capability to WordPress
|
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
35 |
exit; // don't access directly
|
36 |
};
|
37 |
|
38 |
-
define( 'POLYLANG_VERSION', '2.0.
|
39 |
define( 'PLL_MIN_WP_VERSION', '4.0' );
|
40 |
|
41 |
define( 'POLYLANG_FILE', __FILE__ ); // this file
|
3 |
/*
|
4 |
Plugin Name: Polylang
|
5 |
Plugin URI: https://polylang.pro
|
6 |
+
Version: 2.0.12
|
7 |
Author: Frédéric Demarle
|
8 |
Author uri: https://polylang.pro
|
9 |
Description: Adds multilingual capability to WordPress
|
35 |
exit; // don't access directly
|
36 |
};
|
37 |
|
38 |
+
define( 'POLYLANG_VERSION', '2.0.12' );
|
39 |
define( 'PLL_MIN_WP_VERSION', '4.0' );
|
40 |
|
41 |
define( 'POLYLANG_FILE', __FILE__ ); // this file
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://polylang.pro
|
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 2.0.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
@@ -77,6 +77,12 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
|
|
77 |
|
78 |
== Changelog ==
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
= 2.0.11 (2016-12-12) =
|
81 |
|
82 |
* Pro: Fix shared term slugs broken by a late change in WP 4.7 #73
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 2.0.12
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Making WordPress multilingual
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 2.0.12 (2016-12-19) =
|
81 |
+
|
82 |
+
* Fix plugin not loaded first (introduced in 2.0.11)
|
83 |
+
* Fix wrong translations files loaded when the language is set from the content in WP 4.7 #76
|
84 |
+
* Fix notice when a tax query has no terms (using EXISTS or NOT EXISTS)
|
85 |
+
|
86 |
= 2.0.11 (2016-12-12) =
|
87 |
|
88 |
* Pro: Fix shared term slugs broken by a late change in WP 4.7 #73
|