Version Description
(2012-05-13) =
- Add a new argument 'post_id' to the function pll_the_languages to display posts translations within the loop
- Bug correction: every posts in every languages are shown on the homepage when requesting the wrong one with or without 'www.'
- Bug correction: every posts in every languages are shown when requesting /?p=string
- Bug correction: the language is not correctly set for wp-signup.php and wp-activate.php
- Bug correction: wrong home links when using permalinks with front with WP 3.3 and older
- Bug correction: wrong redirection after posting a comment when adding the language information to all urls
- Bug correction: term language may be lost in some situations
- Bug correction: post language is set to default if updated outside the edit post page
- Bug correction: javascript error in WP 3.1
- Bug correction: can't toggle visibility of tags metabox in edit post panel
- Tests done with WordPress 3.4 beta 4
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 0.8.4 |
Comparing to | |
See all releases |
Code changes from version 0.8.3 to 0.8.4
- doc/documentation-en.odt +0 -0
- doc/documentation-en.pdf +0 -0
- include/admin-filters.php +20 -9
- include/base.php +1 -1
- include/calendar.php +1 -1
- include/core.php +28 -12
- js/admin.dev.js +6 -1
- js/admin.js +1 -1
- polylang.php +5 -4
- readme.txt +18 -12
doc/documentation-en.odt
CHANGED
Binary file
|
doc/documentation-en.pdf
CHANGED
Binary file
|
include/admin-filters.php
CHANGED
@@ -111,7 +111,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
111 |
}
|
112 |
|
113 |
// adds the language and translations columns (before the comments column) in the posts and pages list table
|
114 |
-
function add_post_column($columns, $post_type ='') {
|
115 |
return $post_type == '' || in_array($post_type, $this->post_types) ? $this->add_column($columns, 'comments') : $columns;
|
116 |
}
|
117 |
|
@@ -163,10 +163,19 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
163 |
}
|
164 |
}
|
165 |
|
166 |
-
// adds the
|
167 |
-
function add_meta_boxes() {
|
168 |
-
|
169 |
-
add_meta_box('ml_box', __('Languages','polylang'), array(&$this,'post_language'), $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
171 |
|
172 |
// the Languages metabox in the 'Edit Post' and 'Edit Page' panels
|
@@ -325,6 +334,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
325 |
function save_post($post_id, $post) {
|
326 |
|
327 |
// avoids breaking translations when using inline or bulk edit
|
|
|
328 |
if (isset($_POST['_inline_edit']) || isset($_GET['bulk_edit']))
|
329 |
return;
|
330 |
|
@@ -340,6 +350,8 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
340 |
$this->set_post_language($post_id, $_POST['post_lang_choice']);
|
341 |
elseif (isset($_GET['new_lang']))
|
342 |
$this->set_post_language($post_id, $_GET['new_lang']);
|
|
|
|
|
343 |
else
|
344 |
$this->set_post_language($post_id, $this->options['default_lang']);
|
345 |
|
@@ -603,8 +615,8 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
603 |
|
604 |
if (isset($_POST['term_lang_choice']) && $_POST['term_lang_choice'])
|
605 |
$this->set_term_language($term_id, $_POST['term_lang_choice']);
|
606 |
-
|
607 |
-
$this->
|
608 |
|
609 |
if (!isset($_POST['term_tr_lang']))
|
610 |
return;
|
@@ -683,8 +695,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
683 |
}
|
684 |
|
685 |
// ajax response for edit term form
|
686 |
-
function term_lang_choice()
|
687 |
-
{
|
688 |
$lang = $this->get_language($_POST['lang']);
|
689 |
$term_id = isset($_POST['term_id']) ? $_POST['term_id'] : null;
|
690 |
$taxonomy = $_POST['taxonomy'];
|
111 |
}
|
112 |
|
113 |
// adds the language and translations columns (before the comments column) in the posts and pages list table
|
114 |
+
function add_post_column($columns, $post_type = '') {
|
115 |
return $post_type == '' || in_array($post_type, $this->post_types) ? $this->add_column($columns, 'comments') : $columns;
|
116 |
}
|
117 |
|
163 |
}
|
164 |
}
|
165 |
|
166 |
+
// adds the Language box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels)
|
167 |
+
function add_meta_boxes($post_type) {
|
168 |
+
if (in_array($post_type, $this->post_types))
|
169 |
+
add_meta_box('ml_box', __('Languages','polylang'), array(&$this,'post_language'), $post_type, 'side', 'high');
|
170 |
+
|
171 |
+
// replace tag metabox by our own
|
172 |
+
foreach (get_object_taxonomies($post_type) as $tax_name) {
|
173 |
+
$taxonomy = get_taxonomy($tax_name);
|
174 |
+
if ($taxonomy->show_ui && !is_taxonomy_hierarchical($tax_name)) {
|
175 |
+
remove_meta_box('tagsdiv-' . $tax_name, null, 'side');
|
176 |
+
add_meta_box('pll-tagsdiv-' . $tax_name, $taxonomy->labels->name, 'post_tags_meta_box', null, 'side', 'core', array('taxonomy' => $tax_name));
|
177 |
+
}
|
178 |
+
}
|
179 |
}
|
180 |
|
181 |
// the Languages metabox in the 'Edit Post' and 'Edit Page' panels
|
334 |
function save_post($post_id, $post) {
|
335 |
|
336 |
// avoids breaking translations when using inline or bulk edit
|
337 |
+
// FIXME should be useless now thanks to the idea of Gonçalo Peres few lines below
|
338 |
if (isset($_POST['_inline_edit']) || isset($_GET['bulk_edit']))
|
339 |
return;
|
340 |
|
350 |
$this->set_post_language($post_id, $_POST['post_lang_choice']);
|
351 |
elseif (isset($_GET['new_lang']))
|
352 |
$this->set_post_language($post_id, $_GET['new_lang']);
|
353 |
+
elseif ($this->get_post_language($post_id))
|
354 |
+
{} // avoids breaking the language if post is updated ouside the edit post page (thanks to Gonçalo Peres)
|
355 |
else
|
356 |
$this->set_post_language($post_id, $this->options['default_lang']);
|
357 |
|
615 |
|
616 |
if (isset($_POST['term_lang_choice']) && $_POST['term_lang_choice'])
|
617 |
$this->set_term_language($term_id, $_POST['term_lang_choice']);
|
618 |
+
elseif (isset($_POST['post_lang_choice']))
|
619 |
+
$this->set_term_language($term_id, $_POST['post_lang_choice']);
|
620 |
|
621 |
if (!isset($_POST['term_tr_lang']))
|
622 |
return;
|
695 |
}
|
696 |
|
697 |
// ajax response for edit term form
|
698 |
+
function term_lang_choice() {
|
|
|
699 |
$lang = $this->get_language($_POST['lang']);
|
700 |
$term_id = isset($_POST['term_id']) ? $_POST['term_id'] : null;
|
701 |
$taxonomy = $_POST['taxonomy'];
|
include/base.php
CHANGED
@@ -151,7 +151,7 @@ abstract class Polylang_Base {
|
|
151 |
|
152 |
// adds language information to a link when using pretty permalinks
|
153 |
function add_language_to_link($url, $lang) {
|
154 |
-
if (!isset($lang)) // FIXME avoid notice when adding a page to a custom menu
|
155 |
return;
|
156 |
|
157 |
global $wp_rewrite;
|
151 |
|
152 |
// adds language information to a link when using pretty permalinks
|
153 |
function add_language_to_link($url, $lang) {
|
154 |
+
if (!isset($lang) || !$lang) // FIXME avoid notice when adding a page to a custom menu
|
155 |
return;
|
156 |
|
157 |
global $wp_rewrite;
|
include/calendar.php
CHANGED
@@ -19,7 +19,7 @@ class Polylang_Widget_Calendar extends WP_Widget_Calendar {
|
|
19 |
if ( $title )
|
20 |
echo $before_title . $title . $after_title;
|
21 |
echo '<div id="calendar_wrap">';
|
22 |
-
isset($polylang) && $polylang->get_languages_list() ? $this->get_calendar() : get_calendar(); #modified#
|
23 |
echo '</div>';
|
24 |
echo $after_widget;
|
25 |
}
|
19 |
if ( $title )
|
20 |
echo $before_title . $title . $after_title;
|
21 |
echo '<div id="calendar_wrap">';
|
22 |
+
isset($polylang) && $polylang->get_languages_list() && $polylang->get_current_language() ? $this->get_calendar() : get_calendar(); #modified#
|
23 |
echo '</div>';
|
24 |
echo $after_widget;
|
25 |
}
|
include/core.php
CHANGED
@@ -18,6 +18,9 @@ class Polylang_Core extends Polylang_base {
|
|
18 |
$this->page_for_posts = get_option('page_for_posts');
|
19 |
$this->page_on_front = get_option('page_on_front');
|
20 |
|
|
|
|
|
|
|
21 |
// text domain management
|
22 |
add_action('init', array(&$this, 'init'));
|
23 |
add_filter('override_load_textdomain', array(&$this, 'mofile'), 10, 3);
|
@@ -25,7 +28,7 @@ class Polylang_Core extends Polylang_base {
|
|
25 |
add_action('login_init', array(&$this, 'load_textdomains'));
|
26 |
|
27 |
// filters posts according to the language
|
28 |
-
add_filter('pre_get_posts', array(&$this, 'pre_get_posts'))
|
29 |
|
30 |
// filter sticky posts by current language
|
31 |
add_filter('option_sticky_posts', array(&$this, 'option_sticky_posts'));
|
@@ -140,7 +143,7 @@ class Polylang_Core extends Polylang_base {
|
|
140 |
} // options['browser']
|
141 |
|
142 |
// return default if there is no preferences in the browser or preferences does not match our languages or it is requested not to use the browser preference
|
143 |
-
return isset($pref_lang) ? $pref_lang : $this->get_language($this->options['default_lang']);
|
144 |
}
|
145 |
|
146 |
// returns the current language
|
@@ -164,7 +167,14 @@ class Polylang_Core extends Polylang_base {
|
|
164 |
$lang = $this->get_term_language($var, $taxonomy);
|
165 |
}
|
166 |
}
|
167 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
|
170 |
// save the default locale before we start any language manipulation
|
@@ -231,12 +241,12 @@ class Polylang_Core extends Polylang_base {
|
|
231 |
// filters posts according to the language
|
232 |
function pre_get_posts($query) {
|
233 |
// don't make anything if no language has been defined yet
|
234 |
-
if(!$this->get_languages_list())
|
235 |
return;
|
236 |
|
237 |
$qvars = $query->query_vars;
|
238 |
|
239 |
-
// users may want to display content in a different
|
240 |
if ($this->curlang && isset($qvars['lang']) && $qvars['lang'])
|
241 |
return;
|
242 |
|
@@ -247,11 +257,14 @@ class Polylang_Core extends Polylang_base {
|
|
247 |
return;
|
248 |
|
249 |
// homepage is requested, let's set the language
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
255 |
// find out the language
|
256 |
if ($this->options['hide_default'] && isset($_COOKIE['wordpress_polylang']))
|
257 |
$this->curlang = $this->get_language($this->options['default_lang']);
|
@@ -642,9 +655,10 @@ class Polylang_Core extends Polylang_base {
|
|
642 |
'show_flags' => 0, // don't show flags
|
643 |
'show_names' => 1, // show language names
|
644 |
'display_names_as' => 'name', // valid options are slug and name
|
645 |
-
'force_home' => 0, // tries to find a translation
|
646 |
'hide_if_no_translation' => 0, // don't hide the link if there is no translation
|
647 |
'hide_current' => 0, // don't hide current language
|
|
|
648 |
);
|
649 |
extract(wp_parse_args($args, $defaults));
|
650 |
|
@@ -659,7 +673,9 @@ class Polylang_Core extends Polylang_base {
|
|
659 |
if ($this->curlang->term_id == $language->term_id && $hide_current)
|
660 |
continue;
|
661 |
|
662 |
-
$url = $
|
|
|
|
|
663 |
$url = apply_filters('pll_the_language_link', $url, $language->slug, $language->description);
|
664 |
|
665 |
// hide if no translation exists
|
18 |
$this->page_for_posts = get_option('page_for_posts');
|
19 |
$this->page_on_front = get_option('page_on_front');
|
20 |
|
21 |
+
// sets the language of comment
|
22 |
+
add_action('pre_comment_on_post', array(&$this, 'pre_comment_on_post'));
|
23 |
+
|
24 |
// text domain management
|
25 |
add_action('init', array(&$this, 'init'));
|
26 |
add_filter('override_load_textdomain', array(&$this, 'mofile'), 10, 3);
|
28 |
add_action('login_init', array(&$this, 'load_textdomains'));
|
29 |
|
30 |
// filters posts according to the language
|
31 |
+
add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
|
32 |
|
33 |
// filter sticky posts by current language
|
34 |
add_filter('option_sticky_posts', array(&$this, 'option_sticky_posts'));
|
143 |
} // options['browser']
|
144 |
|
145 |
// return default if there is no preferences in the browser or preferences does not match our languages or it is requested not to use the browser preference
|
146 |
+
return isset($pref_lang) && !is_wp_error($pref_lang) ? $pref_lang : $this->get_language($this->options['default_lang']);
|
147 |
}
|
148 |
|
149 |
// returns the current language
|
167 |
$lang = $this->get_term_language($var, $taxonomy);
|
168 |
}
|
169 |
}
|
170 |
+
return isset($lang) ? $lang : false;
|
171 |
+
}
|
172 |
+
|
173 |
+
// sets the language of comment
|
174 |
+
// useful to redirect to correct post comment url when adding the language to all url
|
175 |
+
function pre_comment_on_post($post_id) {
|
176 |
+
$this->curlang = $this->get_post_language($post_id);
|
177 |
+
$this->add_post_term_link_filters();
|
178 |
}
|
179 |
|
180 |
// save the default locale before we start any language manipulation
|
241 |
// filters posts according to the language
|
242 |
function pre_get_posts($query) {
|
243 |
// don't make anything if no language has been defined yet
|
244 |
+
if (!$this->get_languages_list())
|
245 |
return;
|
246 |
|
247 |
$qvars = $query->query_vars;
|
248 |
|
249 |
+
// users may want to display content in a different language than the current one by setting it explicitely in the query
|
250 |
if ($this->curlang && isset($qvars['lang']) && $qvars['lang'])
|
251 |
return;
|
252 |
|
257 |
return;
|
258 |
|
259 |
// homepage is requested, let's set the language
|
260 |
+
if (is_home() && !$this->curlang) {
|
261 |
+
// special case for wp-signup.php & wp-activate.php for which WP set is_home to true
|
262 |
+
if (false === strpos($_SERVER['SCRIPT_NAME'], 'index.php')) {
|
263 |
+
$this->curlang = $this->get_preferred_language();
|
264 |
+
return;
|
265 |
+
}
|
266 |
+
|
267 |
+
// now, it should be the true homepage
|
268 |
// find out the language
|
269 |
if ($this->options['hide_default'] && isset($_COOKIE['wordpress_polylang']))
|
270 |
$this->curlang = $this->get_language($this->options['default_lang']);
|
655 |
'show_flags' => 0, // don't show flags
|
656 |
'show_names' => 1, // show language names
|
657 |
'display_names_as' => 'name', // valid options are slug and name
|
658 |
+
'force_home' => 0, // tries to find a translation
|
659 |
'hide_if_no_translation' => 0, // don't hide the link if there is no translation
|
660 |
'hide_current' => 0, // don't hide current language
|
661 |
+
'post_id' => null, // if not null, link to translations of post defined by post_id
|
662 |
);
|
663 |
extract(wp_parse_args($args, $defaults));
|
664 |
|
673 |
if ($this->curlang->term_id == $language->term_id && $hide_current)
|
674 |
continue;
|
675 |
|
676 |
+
$url = $post_id !== null && ($tr_id = $this->get_post($post_id, $language)) ? get_permalink($tr_id) :
|
677 |
+
$post_id === null && !$force_home ? $this->get_translation_url($language) : null;
|
678 |
+
|
679 |
$url = apply_filters('pll_the_language_link', $url, $language->slug, $language->description);
|
680 |
|
681 |
// hide if no translation exists
|
js/admin.dev.js
CHANGED
@@ -34,7 +34,10 @@ pll_tagBox = {
|
|
34 |
if ( !thetags.length )
|
35 |
return;
|
36 |
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
current_tags = thetags.val().split(',');
|
40 |
tagchecklist.empty();
|
@@ -191,6 +194,7 @@ jQuery(document).ready(function($) {
|
|
191 |
taxonomies.push(taxonomy); // store the taxonomy for future use
|
192 |
|
193 |
// add our hidden field in the new category form - for each hierarchical taxonomy
|
|
|
194 |
$('#' + taxonomy + '-add-submit').before($('<input />')
|
195 |
.attr('type', 'hidden')
|
196 |
.attr('id', taxonomy + '-lang')
|
@@ -244,6 +248,7 @@ jQuery(document).ready(function($) {
|
|
244 |
// Tag box
|
245 |
|
246 |
// replace WP class by our own to avoid using tagBox functions
|
|
|
247 |
$('#side-sortables, #normal-sortables, #advanced-sortables').children('div.postbox').each(function(){
|
248 |
if ( this.id.indexOf('tagsdiv-') === 0 ) {
|
249 |
$(this).attr('id', 'pll-' + this.id);
|
34 |
if ( !thetags.length )
|
35 |
return;
|
36 |
|
37 |
+
// FIXME: why this modification ?
|
38 |
+
// disabled = thetags.prop('disabled'); // 3.3
|
39 |
+
// disabled = thetags.attr('disabled'); // 3.1
|
40 |
+
disabled = thetags.attr('disabled');
|
41 |
|
42 |
current_tags = thetags.val().split(',');
|
43 |
tagchecklist.empty();
|
194 |
taxonomies.push(taxonomy); // store the taxonomy for future use
|
195 |
|
196 |
// add our hidden field in the new category form - for each hierarchical taxonomy
|
197 |
+
// FIXME is it really useful now that term language can be set based on post_lang_choice ?
|
198 |
$('#' + taxonomy + '-add-submit').before($('<input />')
|
199 |
.attr('type', 'hidden')
|
200 |
.attr('id', taxonomy + '-lang')
|
248 |
// Tag box
|
249 |
|
250 |
// replace WP class by our own to avoid using tagBox functions
|
251 |
+
// FIXME: useless now that I replace the metabox in the PHP code
|
252 |
$('#side-sortables, #normal-sortables, #advanced-sortables').children('div.postbox').each(function(){
|
253 |
if ( this.id.indexOf('tagsdiv-') === 0 ) {
|
254 |
$(this).attr('id', 'pll-' + this.id);
|
js/admin.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
var pll_tagBox;(function($){pll_tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,',').replace(/,+/g,',').replace(/[,\s]+$/,'').replace(/^[,\s]+/,'');},parseTags:function(el){var id=el.id,num=id.split('-check-num-')[1],taxbox=$(el).closest('.tagsdiv'),thetags=taxbox.find('.the-tags'),current_tags=thetags.val().split(','),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val);}});thetags.val(this.clean(new_tags.join(',')));this.quickClicks(taxbox);return false;},quickClicks:function(el){var thetags=$('.the-tags',el),tagchecklist=$('.tagchecklist',el),id=$(el).attr('id'),current_tags,disabled;if(!thetags.length)
|
2 |
-
return;disabled=thetags.
|
3 |
return;span=$('<span />').text(val);if(!disabled){xbutton=$('<a id="'+id+'-check-num-'+key+'" class="ntdelbutton">X</a>');xbutton.click(function(){pll_tagBox.parseTags(this);});span.prepend(' ').prepend(xbutton);}
|
4 |
tagchecklist.append(span);});},flushTags:function(el,a,f){a=a||false;var text,tags=$('.the-tags',el),newtag=$('input.newtag',el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+','+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(',')).join(',');tags.val(newtags);this.quickClicks(el);if(!a)
|
5 |
newtag.val('');if('undefined'==typeof(f))
|
1 |
var pll_tagBox;(function($){pll_tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,',').replace(/,+/g,',').replace(/[,\s]+$/,'').replace(/^[,\s]+/,'');},parseTags:function(el){var id=el.id,num=id.split('-check-num-')[1],taxbox=$(el).closest('.tagsdiv'),thetags=taxbox.find('.the-tags'),current_tags=thetags.val().split(','),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val);}});thetags.val(this.clean(new_tags.join(',')));this.quickClicks(taxbox);return false;},quickClicks:function(el){var thetags=$('.the-tags',el),tagchecklist=$('.tagchecklist',el),id=$(el).attr('id'),current_tags,disabled;if(!thetags.length)
|
2 |
+
return;disabled=thetags.attr('disabled');current_tags=thetags.val().split(',');tagchecklist.empty();$.each(current_tags,function(key,val){var span,xbutton;val=$.trim(val);if(!val)
|
3 |
return;span=$('<span />').text(val);if(!disabled){xbutton=$('<a id="'+id+'-check-num-'+key+'" class="ntdelbutton">X</a>');xbutton.click(function(){pll_tagBox.parseTags(this);});span.prepend(' ').prepend(xbutton);}
|
4 |
tagchecklist.append(span);});},flushTags:function(el,a,f){a=a||false;var text,tags=$('.the-tags',el),newtag=$('input.newtag',el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+','+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(',')).join(',');tags.val(newtags);this.quickClicks(el);if(!a)
|
5 |
newtag.val('');if('undefined'==typeof(f))
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/polylang/
|
5 |
-
Version: 0.8.
|
6 |
Author: F. Demarle
|
7 |
Description: Adds multilingual capability to Wordpress
|
8 |
*/
|
@@ -24,7 +24,7 @@ Description: Adds multilingual capability to Wordpress
|
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
|
27 |
-
define('POLYLANG_VERSION', '0.8.
|
28 |
define('PLL_MIN_WP_VERSION', '3.1');
|
29 |
|
30 |
define('POLYLANG_DIR', dirname(__FILE__)); // our directory
|
@@ -304,7 +304,8 @@ class Polylang extends Polylang_Base {
|
|
304 |
|
305 |
// optionaly removes 'language' in permalinks so that we get http://www.myblog/en/ instead of http://www.myblog/language/en/
|
306 |
// language information always in front of the uri ('with_front' => false)
|
307 |
-
|
|
|
308 |
|
309 |
load_plugin_textdomain('polylang', false, basename(POLYLANG_DIR).'/languages'); // plugin i18n
|
310 |
}
|
@@ -353,7 +354,7 @@ class Polylang extends Polylang_Base {
|
|
353 |
$languages[] = $language->slug;
|
354 |
|
355 |
if (isset($languages))
|
356 |
-
$slug = $options['rewrite'] ?
|
357 |
|
358 |
foreach ($rules as $key => $rule) {
|
359 |
// we don't need the lang parameter for post types and taxonomies
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/polylang/
|
5 |
+
Version: 0.8.4
|
6 |
Author: F. Demarle
|
7 |
Description: Adds multilingual capability to Wordpress
|
8 |
*/
|
24 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25 |
*/
|
26 |
|
27 |
+
define('POLYLANG_VERSION', '0.8.4');
|
28 |
define('PLL_MIN_WP_VERSION', '3.1');
|
29 |
|
30 |
define('POLYLANG_DIR', dirname(__FILE__)); // our directory
|
304 |
|
305 |
// optionaly removes 'language' in permalinks so that we get http://www.myblog/en/ instead of http://www.myblog/language/en/
|
306 |
// language information always in front of the uri ('with_front' => false)
|
307 |
+
// the 3rd parameter structure has been modified in WP 3.4
|
308 |
+
add_permastruct('language', $options['rewrite'] ? '%language%' : 'language/%language%', version_compare($GLOBALS['wp_version'], '3.4' , '<') ? false : array('with_front' => false));
|
309 |
|
310 |
load_plugin_textdomain('polylang', false, basename(POLYLANG_DIR).'/languages'); // plugin i18n
|
311 |
}
|
354 |
$languages[] = $language->slug;
|
355 |
|
356 |
if (isset($languages))
|
357 |
+
$slug = $wp_rewrite->root . ($options['rewrite'] ? '' : 'language/') . '('.implode('|', $languages).')/';
|
358 |
|
359 |
foreach ($rules as $key => $rule) {
|
360 |
// we don't need the lang parameter for post types and taxonomies
|
readme.txt
CHANGED
@@ -4,16 +4,12 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, i18n, international, l10n, localization
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.4
|
7 |
-
Stable tag: 0.8.
|
8 |
|
9 |
Polylang adds multilingual content management support to WordPress.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
= Upgrade Notice =
|
14 |
-
|
15 |
-
When upgrading from 0.5.1 or older, your custom flags in 'wp-content/plugins/polylang/local_flags' directory should move to 'wp-content/polylang'. People using the function 'pll_the_language' should be aware that it does not display the 'ul' tag anymore. I wrote about the reasons for these changes in the [forum](http://wordpress.org/support/topic/development-of-polylang-version-06). When upgrading from 0.6.1 or older, people using RTL languages must edit these languages and set the text direction to RTL in order for Polylang to work properly (the RTL property of the language is not set automatically when upgrading).
|
16 |
-
|
17 |
= Features =
|
18 |
|
19 |
You write posts, pages and create categories and post tags as usual, and then define the language for each of them. The translation is optional. The plugin does not integrate automatic or professional translation.
|
@@ -51,10 +47,6 @@ Other [contributions](http://wordpress.org/extend/plugins/polylang/other_notes/)
|
|
51 |
|
52 |
Don't hesitate to [give your feedback](http://wordpress.org/tags/polylang?forum_id=10). It will help making the plugin better. Don't hesitate to rate the plugin too.
|
53 |
|
54 |
-
== Upgrade Notice ==
|
55 |
-
|
56 |
-
When upgrading from 0.5.1 or older, your custom flags in 'wp-content/plugins/polylang/local_flags' directory should move to 'wp-content/polylang'. People using the function 'pll_the_language' should be aware that it does not display the ul tag anymore. When upgrading from 0.6.1 or older, people using RTL languages must edit these languages and set the text direction to RTL in order for Polylang to work properly (the RTL property of the language is not set automatically when upgrading).
|
57 |
-
|
58 |
== Installation ==
|
59 |
|
60 |
1. Make sure you are using WordPress 3.1 or later and that your server is running PHP5 (if you are using WordPress 3.2 or newer, it does !)
|
@@ -117,7 +109,21 @@ Every suggestions are welcome.
|
|
117 |
|
118 |
== Changelog ==
|
119 |
|
120 |
-
= 0.8.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
* Add Danish translation contributed by [Compute]((http://wordpress.org/support/profile/compute)
|
123 |
* Add Spanish translation contributed by Curro
|
@@ -127,8 +133,8 @@ Every suggestions are welcome.
|
|
127 |
* Bug correction: wrong archives links when using permalinks with front
|
128 |
* Bug correction: wrong homepage link when keeping 'language' in permalinks with front
|
129 |
* Bug correction: flush_rewrite_rules notice when setting up a static front page (introduced in 0.8.2)
|
130 |
-
* Bug correction: every
|
131 |
-
* Bug correction: every
|
132 |
* Tests done with WordPress 3.4 beta 1
|
133 |
|
134 |
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, i18n, international, l10n, localization
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.4
|
7 |
+
Stable tag: 0.8.4
|
8 |
|
9 |
Polylang adds multilingual content management support to WordPress.
|
10 |
|
11 |
== Description ==
|
12 |
|
|
|
|
|
|
|
|
|
13 |
= Features =
|
14 |
|
15 |
You write posts, pages and create categories and post tags as usual, and then define the language for each of them. The translation is optional. The plugin does not integrate automatic or professional translation.
|
47 |
|
48 |
Don't hesitate to [give your feedback](http://wordpress.org/tags/polylang?forum_id=10). It will help making the plugin better. Don't hesitate to rate the plugin too.
|
49 |
|
|
|
|
|
|
|
|
|
50 |
== Installation ==
|
51 |
|
52 |
1. Make sure you are using WordPress 3.1 or later and that your server is running PHP5 (if you are using WordPress 3.2 or newer, it does !)
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 0.8.4 (2012-05-13) =
|
113 |
+
|
114 |
+
* Add a new argument 'post_id' to the function pll_the_languages to display posts translations within the loop
|
115 |
+
* Bug correction: every posts in every languages are shown on the homepage when requesting the wrong one with or without 'www.'
|
116 |
+
* Bug correction: every posts in every languages are shown when requesting /?p=string
|
117 |
+
* Bug correction: the language is not correctly set for wp-signup.php and wp-activate.php
|
118 |
+
* Bug correction: wrong home links when using permalinks with front with WP 3.3 and older
|
119 |
+
* Bug correction: wrong redirection after posting a comment when adding the language information to all urls
|
120 |
+
* Bug correction: term language may be lost in some situations
|
121 |
+
* Bug correction: post language is set to default if updated outside the edit post page
|
122 |
+
* Bug correction: javascript error in WP 3.1
|
123 |
+
* Bug correction: can't toggle visibility of tags metabox in edit post panel
|
124 |
+
* Tests done with WordPress 3.4 beta 4
|
125 |
+
|
126 |
+
= 0.8.3 (2012-04-10) =
|
127 |
|
128 |
* Add Danish translation contributed by [Compute]((http://wordpress.org/support/profile/compute)
|
129 |
* Add Spanish translation contributed by Curro
|
133 |
* Bug correction: wrong archives links when using permalinks with front
|
134 |
* Bug correction: wrong homepage link when keeping 'language' in permalinks with front
|
135 |
* Bug correction: flush_rewrite_rules notice when setting up a static front page (introduced in 0.8.2)
|
136 |
+
* Bug correction: every posts in every languages are shown when hitting the homepage with a query string unknown to WP (thanks to Gonçalo Peres)
|
137 |
+
* Bug correction: every posts in every languages are shown on the homepage when PHP adds index.php to the url
|
138 |
* Tests done with WordPress 3.4 beta 1
|
139 |
|
140 |
|