Version Description
- Add language filter for widgets
- Improved performance for filtering pages by language
- Improved security
- Minor bug correction with versions management
release: October 7th, 2011
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 0.3 |
Comparing to | |
See all releases |
Code changes from version 0.2 to 0.3
- add-term-form.php +1 -1
- admin.php +75 -17
- edit-term-form.php +6 -1
- languages-form.php +48 -19
- list-table.php +6 -4
- polylang-de_DE.mo +0 -0
- polylang-de_DE.po +28 -20
- polylang-fr_FR.mo +0 -0
- polylang-fr_FR.po +28 -20
- polylang.php +40 -32
- polylang.pot +28 -20
- post-metabox.php +7 -2
- post-translations.php +17 -4
- readme.txt +17 -3
- term-translations.php +22 -9
- uninstall.php +1 -0
add-term-form.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
<select name="term_lang_choice" id="term_lang_choice">
|
5 |
<option value="0"></option><?php
|
6 |
foreach ($listlanguages as $language) {
|
7 |
-
printf("<option value='%s'%s>%s</option>\n", $language->term_id, $language == $lang ? ' selected="selected"' : '', $language->name);
|
8 |
} ?>
|
9 |
</select>
|
10 |
<p><?php _e('Sets the language', 'polylang');?></p>
|
4 |
<select name="term_lang_choice" id="term_lang_choice">
|
5 |
<option value="0"></option><?php
|
6 |
foreach ($listlanguages as $language) {
|
7 |
+
printf("<option value='%s'%s>%s</option>\n", esc_attr($language->term_id), $language == $lang ? ' selected="selected"' : '', esc_attr($language->name));
|
8 |
} ?>
|
9 |
</select>
|
10 |
<p><?php _e('Sets the language', 'polylang');?></p>
|
admin.php
CHANGED
@@ -5,6 +5,8 @@ define('POLYLANG_URL', WP_PLUGIN_URL .'/polylang');
|
|
5 |
|
6 |
class Polylang_Admin extends Polylang_Base {
|
7 |
function __construct() {
|
|
|
|
|
8 |
// adds a 'settings' link in the plugins table
|
9 |
$plugin_file = basename( dirname( __FILE__ ) ).'/polylang.php';
|
10 |
add_filter('plugin_action_links_'.$plugin_file, array(&$this, 'plugin_action_links'));
|
@@ -61,10 +63,24 @@ class Polylang_Admin extends Polylang_Base {
|
|
61 |
// modifies the theme location nav menu metabox
|
62 |
add_filter('admin_head-nav-menus.php', array(&$this, 'nav_menu_theme_locations'));
|
63 |
|
|
|
|
|
|
|
|
|
64 |
// refresh rewrite rules if the 'page_on_front' option is modified
|
65 |
add_action('update_option', array(&$this, 'update_option'));
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
// adds a 'settings' link in the plugins table
|
69 |
function plugin_action_links($links) {
|
70 |
$settings_link = '<a href="admin.php?page=mlang">' . __('Settings') . '</a>';
|
@@ -103,13 +119,16 @@ class Polylang_Admin extends Polylang_Base {
|
|
103 |
case 'add':
|
104 |
check_admin_referer( 'add-lang', '_wpnonce_add-lang' );
|
105 |
|
106 |
-
|
|
|
|
|
107 |
wp_insert_term($_POST['name'],'language',array('slug'=>$_POST['slug'], 'description'=>$_POST['description']));
|
108 |
$wp_rewrite->flush_rules(); // refresh rewrite rules
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
113 |
}
|
114 |
wp_redirect('admin.php?page=mlang'); // to refresh the page (possible thanks to the $_GET['noheader']=true)
|
115 |
exit;
|
@@ -118,8 +137,9 @@ class Polylang_Admin extends Polylang_Base {
|
|
118 |
case 'delete':
|
119 |
check_admin_referer( 'delete-lang');
|
120 |
|
121 |
-
if (isset($_GET['lang'])) {
|
122 |
-
$
|
|
|
123 |
$lang_slug = $lang->slug;
|
124 |
|
125 |
// delete all translations in posts in this language
|
@@ -145,13 +165,13 @@ class Polylang_Admin extends Polylang_Base {
|
|
145 |
foreach ($languages as $language) {
|
146 |
delete_metadata('term', $term->term_id, '_lang-'.$language->slug); // deletes translations of this term
|
147 |
}
|
148 |
-
delete_metadata('term', $term->term_id, '_language', $
|
149 |
}
|
150 |
delete_metadata('term', $term->term_id, '_lang-'.$lang_slug); // deletes references to this term in translated term
|
151 |
}
|
152 |
|
153 |
// delete the language itself
|
154 |
-
wp_delete_term($
|
155 |
$wp_rewrite->flush_rules(); // refresh rewrite rules
|
156 |
|
157 |
// oops ! we deleted the default language...
|
@@ -168,16 +188,18 @@ class Polylang_Admin extends Polylang_Base {
|
|
168 |
break;
|
169 |
|
170 |
case 'edit':
|
171 |
-
if (isset($_GET['lang']))
|
172 |
-
$edit_lang = $this->get_language($_GET['lang']);
|
173 |
break;
|
174 |
|
175 |
case 'update':
|
176 |
check_admin_referer( 'add-lang', '_wpnonce_add-lang' );
|
177 |
|
178 |
-
if
|
|
|
179 |
// Update links to this language in posts and terms in case the slug has been modified
|
180 |
-
$
|
|
|
181 |
$old_slug = $lang->slug;
|
182 |
|
183 |
if ($old_slug != $_POST['slug']) {
|
@@ -202,7 +224,7 @@ class Polylang_Admin extends Polylang_Base {
|
|
202 |
}
|
203 |
|
204 |
// and finally update the language itself
|
205 |
-
wp_update_term($
|
206 |
$wp_rewrite->flush_rules(); // refresh rewrite rules
|
207 |
}
|
208 |
wp_redirect('admin.php?page=mlang'); // to refresh the page (possible thanks to the $_GET['noheader']=true)
|
@@ -211,6 +233,7 @@ class Polylang_Admin extends Polylang_Base {
|
|
211 |
|
212 |
case 'nav-menus':
|
213 |
check_admin_referer( 'nav-menus-lang', '_wpnonce_nav-menus-lang' );
|
|
|
214 |
$menu_lang = $_POST['menu-lang'];
|
215 |
update_option('polylang_nav_menus', $menu_lang);
|
216 |
break;
|
@@ -263,7 +286,7 @@ class Polylang_Admin extends Polylang_Base {
|
|
263 |
function post_column($column, $post_id) {
|
264 |
$lang = $this->get_post_language($post_id);
|
265 |
if ($lang && $column == 'language')
|
266 |
-
echo $lang->name;
|
267 |
}
|
268 |
|
269 |
// converts language term_id to slug in $query
|
@@ -271,7 +294,7 @@ class Polylang_Admin extends Polylang_Base {
|
|
271 |
function parse_query($query) {
|
272 |
global $pagenow;
|
273 |
$qvars = &$query->query_vars;
|
274 |
-
if ($pagenow=='edit.php' && isset($qvars['lang']) && is_numeric($qvars['lang'])) {
|
275 |
$lang = $this->get_language($qvars['lang']);
|
276 |
if ($lang)
|
277 |
$qvars['lang'] = $lang->slug;
|
@@ -438,7 +461,7 @@ class Polylang_Admin extends Polylang_Base {
|
|
438 |
function term_column($empty, $column, $term_id) {
|
439 |
$lang = $this->get_term_language($term_id);
|
440 |
if ($lang && $column == 'language')
|
441 |
-
echo $lang->name;
|
442 |
}
|
443 |
|
444 |
// called when a category or post tag is created or edited
|
@@ -531,6 +554,41 @@ class Polylang_Admin extends Polylang_Base {
|
|
531 |
'<a href="' . admin_url('options-general.php?page=mlang#menus') . '">', '</a>') . '</p>';
|
532 |
}
|
533 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
534 |
// refresh rewrite rules if the 'page_on_front' option is modified
|
535 |
function update_option($option) {
|
536 |
global $wp_rewrite;
|
5 |
|
6 |
class Polylang_Admin extends Polylang_Base {
|
7 |
function __construct() {
|
8 |
+
add_action('admin_init', array(&$this, 'admin_init'));
|
9 |
+
|
10 |
// adds a 'settings' link in the plugins table
|
11 |
$plugin_file = basename( dirname( __FILE__ ) ).'/polylang.php';
|
12 |
add_filter('plugin_action_links_'.$plugin_file, array(&$this, 'plugin_action_links'));
|
63 |
// modifies the theme location nav menu metabox
|
64 |
add_filter('admin_head-nav-menus.php', array(&$this, 'nav_menu_theme_locations'));
|
65 |
|
66 |
+
// widgets languages filter
|
67 |
+
add_action('in_widget_form', array(&$this, 'in_widget_form'));
|
68 |
+
add_filter('widget_update_callback', array(&$this, 'widget_update_callback'), 10, 4);
|
69 |
+
|
70 |
// refresh rewrite rules if the 'page_on_front' option is modified
|
71 |
add_action('update_option', array(&$this, 'update_option'));
|
72 |
}
|
73 |
|
74 |
+
// manage versions
|
75 |
+
// not very useful now but we don't know the future
|
76 |
+
function admin_init() {
|
77 |
+
$options = get_option('polylang');
|
78 |
+
if ($options['version'] < POLYLANG_VERSION) {
|
79 |
+
$options['version'] = POLYLANG_VERSION;
|
80 |
+
update_option('polylang', $options);
|
81 |
+
}
|
82 |
+
}
|
83 |
+
|
84 |
// adds a 'settings' link in the plugins table
|
85 |
function plugin_action_links($links) {
|
86 |
$settings_link = '<a href="admin.php?page=mlang">' . __('Settings') . '</a>';
|
119 |
case 'add':
|
120 |
check_admin_referer( 'add-lang', '_wpnonce_add-lang' );
|
121 |
|
122 |
+
// FIXME improve data validation
|
123 |
+
// FIXME add an error message if conditions are not fulfilled
|
124 |
+
if ($_POST['name'] && $_POST['description'] && $_POST['slug']) {
|
125 |
wp_insert_term($_POST['name'],'language',array('slug'=>$_POST['slug'], 'description'=>$_POST['description']));
|
126 |
$wp_rewrite->flush_rules(); // refresh rewrite rules
|
127 |
+
|
128 |
+
if (!isset($options['default_lang'])) { // if this is the first language created, set it as default language
|
129 |
+
$options['default_lang'] = $_POST['slug'];
|
130 |
+
update_option('polylang', $options);
|
131 |
+
}
|
132 |
}
|
133 |
wp_redirect('admin.php?page=mlang'); // to refresh the page (possible thanks to the $_GET['noheader']=true)
|
134 |
exit;
|
137 |
case 'delete':
|
138 |
check_admin_referer( 'delete-lang');
|
139 |
|
140 |
+
if (isset($_GET['lang']) && $_GET['lang']) {
|
141 |
+
$lang_id = (int) $_GET['lang'];
|
142 |
+
$lang = $this->get_language($lang_id);
|
143 |
$lang_slug = $lang->slug;
|
144 |
|
145 |
// delete all translations in posts in this language
|
165 |
foreach ($languages as $language) {
|
166 |
delete_metadata('term', $term->term_id, '_lang-'.$language->slug); // deletes translations of this term
|
167 |
}
|
168 |
+
delete_metadata('term', $term->term_id, '_language', $lang_id); // delete language of this term
|
169 |
}
|
170 |
delete_metadata('term', $term->term_id, '_lang-'.$lang_slug); // deletes references to this term in translated term
|
171 |
}
|
172 |
|
173 |
// delete the language itself
|
174 |
+
wp_delete_term($lang_id, 'language');
|
175 |
$wp_rewrite->flush_rules(); // refresh rewrite rules
|
176 |
|
177 |
// oops ! we deleted the default language...
|
188 |
break;
|
189 |
|
190 |
case 'edit':
|
191 |
+
if (isset($_GET['lang']) && $_GET['lang'])
|
192 |
+
$edit_lang = $this->get_language((int) $_GET['lang']);
|
193 |
break;
|
194 |
|
195 |
case 'update':
|
196 |
check_admin_referer( 'add-lang', '_wpnonce_add-lang' );
|
197 |
|
198 |
+
// FIXME add an error message if conditions are not fulfilled
|
199 |
+
if ($_POST['lang'] && $_POST['name'] && $_POST['description'] && $_POST['slug']) {
|
200 |
// Update links to this language in posts and terms in case the slug has been modified
|
201 |
+
$lang_id = (int) $_POST['lang'];
|
202 |
+
$lang = $this->get_language($lang_id);
|
203 |
$old_slug = $lang->slug;
|
204 |
|
205 |
if ($old_slug != $_POST['slug']) {
|
224 |
}
|
225 |
|
226 |
// and finally update the language itself
|
227 |
+
wp_update_term($lang_id, 'language', array('name'=>$_POST['name'], 'slug'=>$_POST['slug'], 'description'=>$_POST['description']));
|
228 |
$wp_rewrite->flush_rules(); // refresh rewrite rules
|
229 |
}
|
230 |
wp_redirect('admin.php?page=mlang'); // to refresh the page (possible thanks to the $_GET['noheader']=true)
|
233 |
|
234 |
case 'nav-menus':
|
235 |
check_admin_referer( 'nav-menus-lang', '_wpnonce_nav-menus-lang' );
|
236 |
+
|
237 |
$menu_lang = $_POST['menu-lang'];
|
238 |
update_option('polylang_nav_menus', $menu_lang);
|
239 |
break;
|
286 |
function post_column($column, $post_id) {
|
287 |
$lang = $this->get_post_language($post_id);
|
288 |
if ($lang && $column == 'language')
|
289 |
+
echo esc_attr($lang->name);
|
290 |
}
|
291 |
|
292 |
// converts language term_id to slug in $query
|
294 |
function parse_query($query) {
|
295 |
global $pagenow;
|
296 |
$qvars = &$query->query_vars;
|
297 |
+
if ($pagenow=='edit.php' && isset($qvars['lang']) && $qvars['lang'] && is_numeric($qvars['lang'])) {
|
298 |
$lang = $this->get_language($qvars['lang']);
|
299 |
if ($lang)
|
300 |
$qvars['lang'] = $lang->slug;
|
461 |
function term_column($empty, $column, $term_id) {
|
462 |
$lang = $this->get_term_language($term_id);
|
463 |
if ($lang && $column == 'language')
|
464 |
+
echo esc_attr($lang->name);
|
465 |
}
|
466 |
|
467 |
// called when a category or post tag is created or edited
|
554 |
'<a href="' . admin_url('options-general.php?page=mlang#menus') . '">', '</a>') . '</p>';
|
555 |
}
|
556 |
|
557 |
+
// modifies the widgets forms to add our language dropdwown list
|
558 |
+
function in_widget_form($widget) {
|
559 |
+
$id = esc_attr($widget->id.'_lang_choice');
|
560 |
+
$listlanguages = $this->get_languages_list();
|
561 |
+
$widget_lang = get_option('polylang_widgets');
|
562 |
+
|
563 |
+
printf(
|
564 |
+
'<p><label for="%s">%s<select name="%s" id="%s" class="tags-input"><option value="0">%s</option>',
|
565 |
+
$id,
|
566 |
+
__('The widget is displayed for:', 'polylang'),
|
567 |
+
$id,
|
568 |
+
$id,
|
569 |
+
__('All languages', 'polylang')
|
570 |
+
);
|
571 |
+
foreach ($listlanguages as $language) {
|
572 |
+
printf(
|
573 |
+
"<option value='%s'%s>%s</option>\n",
|
574 |
+
esc_attr($language->slug),
|
575 |
+
$language->slug == $widget_lang[$widget->id] ? ' selected="selected"' : '',
|
576 |
+
esc_attr($language->name)
|
577 |
+
);
|
578 |
+
}
|
579 |
+
echo '</select></label></p>';
|
580 |
+
}
|
581 |
+
|
582 |
+
// called when widget options are saved
|
583 |
+
function widget_update_callback($instance, $new_instance, $old_instance, $widget) {
|
584 |
+
$id = $widget->id.'_lang_choice';
|
585 |
+
if (isset($_POST[$id]) && $_POST[$id]) {
|
586 |
+
$widget_lang = get_option('polylang_widgets');
|
587 |
+
$widget_lang[$widget->id] = $_POST[$id];
|
588 |
+
update_option('polylang_widgets', $widget_lang);
|
589 |
+
}
|
590 |
+
}
|
591 |
+
|
592 |
// refresh rewrite rules if the 'page_on_front' option is modified
|
593 |
function update_option($option) {
|
594 |
global $wp_rewrite;
|
edit-term-form.php
CHANGED
@@ -7,7 +7,12 @@
|
|
7 |
<td><select name="term_lang_choice" id="term_lang_choice">
|
8 |
<option value="0"></option><?php
|
9 |
foreach ($listlanguages as $language) {
|
10 |
-
printf(
|
|
|
|
|
|
|
|
|
|
|
11 |
} ?>
|
12 |
</select><br />
|
13 |
<span class="description"><?php _e('Sets the language', 'polylang');?></span></td>
|
7 |
<td><select name="term_lang_choice" id="term_lang_choice">
|
8 |
<option value="0"></option><?php
|
9 |
foreach ($listlanguages as $language) {
|
10 |
+
printf(
|
11 |
+
"<option value='%s'%s>%s</option>\n",
|
12 |
+
esc_attr($language->term_id),
|
13 |
+
$language == $lang ? ' selected="selected"' : '',
|
14 |
+
esc_attr($language->name)
|
15 |
+
);
|
16 |
} ?>
|
17 |
</select><br />
|
18 |
<span class="description"><?php _e('Sets the language', 'polylang');?></span></td>
|
languages-form.php
CHANGED
@@ -36,7 +36,7 @@
|
|
36 |
|
37 |
if ($action=='edit') {?>
|
38 |
<input type="hidden" name="action" value="update" />
|
39 |
-
<input type="hidden" name="lang" value="<?php echo $edit_lang->term_id;?>" /><?php
|
40 |
}
|
41 |
else { ?>
|
42 |
<input type="hidden" name="action" value="add" /><?php
|
@@ -44,19 +44,19 @@ else { ?>
|
|
44 |
|
45 |
<div class="form-field form-required">
|
46 |
<label for="name"><?php _e('Full name', 'polylang');?></label>
|
47 |
-
<input name="name" id="name" type="text" value="<?php if ($action=='edit') echo $edit_lang->name;?>" size="40" aria-required="true" />
|
48 |
<p><?php _e('The name is how it is displayed on your site (for example: English).', 'polylang');?></p>
|
49 |
</div>
|
50 |
|
51 |
<div class="form-field form-required">
|
52 |
<label for="description"><?php _e('Locale', 'polylang');?></label>
|
53 |
-
<input name="description" id="description" type="text" value="<?php if ($action=='edit') echo $edit_lang->description;?>" size="40" aria-required="true" />
|
54 |
<p><?php _e('Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language.', 'polylang');?></p>
|
55 |
</div>
|
56 |
|
57 |
<div class="form-field">
|
58 |
<label for="slug"><?php _e('Language code', 'polylang');?></label>
|
59 |
-
<input name="slug" id="slug" type="text" value="<?php if ($action=='edit') echo $edit_lang->slug;?>" size="40" />
|
60 |
<p><?php _e('2-letters ISO 639-1 language code (for example: en)', 'polylang');?></p>
|
61 |
</div>
|
62 |
|
@@ -85,21 +85,30 @@ if (current_theme_supports( 'menus' )) { ?>
|
|
85 |
<thead><tr>
|
86 |
<th><?php _e('Theme location','Polylang') ?></th><?php
|
87 |
foreach ($listlanguages as $language) {
|
88 |
-
echo '<th>' . $language->name . '</th>';
|
89 |
} ?>
|
90 |
</tr></thead>
|
91 |
|
92 |
<tbody>
|
93 |
<?php foreach ( $locations as $location => $description ) { ?>
|
94 |
-
<tr><td><?php echo $description; ?></td><?php
|
95 |
foreach ($listlanguages as $language) { ?>
|
96 |
-
<td><?php
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
$menu_lang[$location][$language->slug] == $menu->term_id ? ' selected="selected"' : '',
|
102 |
-
$menu->name)
|
|
|
103 |
} ?>
|
104 |
</select></td><?php
|
105 |
}?>
|
@@ -128,25 +137,45 @@ if (current_theme_supports( 'menus' )) { ?>
|
|
128 |
<table class="form-table">
|
129 |
|
130 |
<tr>
|
131 |
-
<th style="width: 300px;"><label><?php
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
133 |
<td><code><?php echo home_url('language/en/'); ?></code></td>
|
134 |
</tr>
|
135 |
|
136 |
<tr>
|
137 |
-
<th><label><?php
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
<td><code><?php echo home_url('en/'); ?></code></td>
|
140 |
</tr>
|
141 |
|
142 |
<tr>
|
143 |
<th><?php _e('The front page default language is : ', 'polylang');?></th>
|
144 |
-
<td><label><?php
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
146 |
<label><?php _e('otherwise: ', 'polylang');?><select name="default_lang" id="default_lang">
|
147 |
<?php $listlanguages = $this->get_languages_list();
|
148 |
foreach ($listlanguages as $language) {
|
149 |
-
printf(
|
|
|
|
|
|
|
|
|
|
|
150 |
} ?>
|
151 |
</select></label>
|
152 |
</td>
|
36 |
|
37 |
if ($action=='edit') {?>
|
38 |
<input type="hidden" name="action" value="update" />
|
39 |
+
<input type="hidden" name="lang" value="<?php echo esc_attr($edit_lang->term_id);?>" /><?php
|
40 |
}
|
41 |
else { ?>
|
42 |
<input type="hidden" name="action" value="add" /><?php
|
44 |
|
45 |
<div class="form-field form-required">
|
46 |
<label for="name"><?php _e('Full name', 'polylang');?></label>
|
47 |
+
<input name="name" id="name" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->name);?>" size="40" aria-required="true" />
|
48 |
<p><?php _e('The name is how it is displayed on your site (for example: English).', 'polylang');?></p>
|
49 |
</div>
|
50 |
|
51 |
<div class="form-field form-required">
|
52 |
<label for="description"><?php _e('Locale', 'polylang');?></label>
|
53 |
+
<input name="description" id="description" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->description);?>" size="40" aria-required="true" />
|
54 |
<p><?php _e('Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language.', 'polylang');?></p>
|
55 |
</div>
|
56 |
|
57 |
<div class="form-field">
|
58 |
<label for="slug"><?php _e('Language code', 'polylang');?></label>
|
59 |
+
<input name="slug" id="slug" type="text" value="<?php if ($action=='edit') echo esc_attr($edit_lang->slug);?>" size="40" />
|
60 |
<p><?php _e('2-letters ISO 639-1 language code (for example: en)', 'polylang');?></p>
|
61 |
</div>
|
62 |
|
85 |
<thead><tr>
|
86 |
<th><?php _e('Theme location','Polylang') ?></th><?php
|
87 |
foreach ($listlanguages as $language) {
|
88 |
+
echo '<th>' . esc_attr($language->name) . '</th>';
|
89 |
} ?>
|
90 |
</tr></thead>
|
91 |
|
92 |
<tbody>
|
93 |
<?php foreach ( $locations as $location => $description ) { ?>
|
94 |
+
<tr><td><?php echo esc_attr($description); ?></td><?php
|
95 |
foreach ($listlanguages as $language) { ?>
|
96 |
+
<td><?php
|
97 |
+
printf(
|
98 |
+
'<select name="menu-lang[%s][%s]" id="menu-lang-%s-%s">',
|
99 |
+
esc_attr($location),
|
100 |
+
esc_attr($language->slug),
|
101 |
+
esc_attr($location),
|
102 |
+
esc_attr($language->slug)
|
103 |
+
);?>
|
104 |
+
<option value="0"></option><?php
|
105 |
+
foreach ( $menus as $menu ) {
|
106 |
+
printf(
|
107 |
+
"<option value='%s'%s>%s</option>\n",
|
108 |
+
esc_attr($menu->term_id),
|
109 |
$menu_lang[$location][$language->slug] == $menu->term_id ? ' selected="selected"' : '',
|
110 |
+
esc_attr($menu->name)
|
111 |
+
);
|
112 |
} ?>
|
113 |
</select></td><?php
|
114 |
}?>
|
137 |
<table class="form-table">
|
138 |
|
139 |
<tr>
|
140 |
+
<th style="width: 300px;"><label><?php
|
141 |
+
printf(
|
142 |
+
'<input name="rewrite" type="radio" value="0" %s /> %s',
|
143 |
+
$options['rewrite'] ? '' : 'checked="checked"',
|
144 |
+
__('Keep /language/ in pretty permalinks', 'polylang')
|
145 |
+
);?>
|
146 |
+
</label></th>
|
147 |
<td><code><?php echo home_url('language/en/'); ?></code></td>
|
148 |
</tr>
|
149 |
|
150 |
<tr>
|
151 |
+
<th><label><?php
|
152 |
+
printf(
|
153 |
+
'<input name="rewrite" type="radio" value="1" %s /> %s',
|
154 |
+
$options['rewrite'] ? 'checked="checked"' : '',
|
155 |
+
__('Remove /language/ in pretty permalinks', 'polylang')
|
156 |
+
);?>
|
157 |
+
</label></th>
|
158 |
<td><code><?php echo home_url('en/'); ?></code></td>
|
159 |
</tr>
|
160 |
|
161 |
<tr>
|
162 |
<th><?php _e('The front page default language is : ', 'polylang');?></th>
|
163 |
+
<td><label><?php
|
164 |
+
printf(
|
165 |
+
'<input name="browser" type="checkbox" value="1" %s /> %s',
|
166 |
+
$options['browser'] ? 'checked="checked"' :'',
|
167 |
+
__('set by the browser preference', 'polylang')
|
168 |
+
);?>
|
169 |
+
</label>
|
170 |
<label><?php _e('otherwise: ', 'polylang');?><select name="default_lang" id="default_lang">
|
171 |
<?php $listlanguages = $this->get_languages_list();
|
172 |
foreach ($listlanguages as $language) {
|
173 |
+
printf(
|
174 |
+
"<option value='%s'%s>%s</option>\n",
|
175 |
+
esc_attr($language->slug),
|
176 |
+
$options['default_lang'] == $language->slug ? ' selected="selected"' : '',
|
177 |
+
esc_attr($language->name)
|
178 |
+
);
|
179 |
} ?>
|
180 |
</select></label>
|
181 |
</td>
|
list-table.php
CHANGED
@@ -26,9 +26,11 @@ class Polylang_List_Table extends WP_List_Table {
|
|
26 |
}
|
27 |
|
28 |
function column_name($item){
|
|
|
|
|
29 |
$actions = array(
|
30 |
-
'edit' =>
|
31 |
-
'delete' => '<a href="' .
|
32 |
);
|
33 |
|
34 |
return $item['name'].$this->row_actions($actions);
|
@@ -37,8 +39,8 @@ class Polylang_List_Table extends WP_List_Table {
|
|
37 |
function column_cb($item){
|
38 |
return sprintf(
|
39 |
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
40 |
-
/*$1%s*/ $this->_args['singular'],
|
41 |
-
/*$2%s*/ $item['term_id']
|
42 |
);
|
43 |
}
|
44 |
|
26 |
}
|
27 |
|
28 |
function column_name($item){
|
29 |
+
$edit_link = esc_url(admin_url('admin.php?page=mlang&action=edit&lang='.$item['term_id']));
|
30 |
+
$delete_link = wp_nonce_url('?page=mlang&action=delete&noheader=true&lang=' . $item['term_id'], 'delete-lang');
|
31 |
$actions = array(
|
32 |
+
'edit' => '<a href="' . $edit_link . '">' . __('Edit','polylang') . '</a>',
|
33 |
+
'delete' => '<a href="' . $delete_link .'">' . __('Delete','polylang') .'</a>'
|
34 |
);
|
35 |
|
36 |
return $item['name'].$this->row_actions($actions);
|
39 |
function column_cb($item){
|
40 |
return sprintf(
|
41 |
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
42 |
+
/*$1%s*/ esc_attr($this->_args['singular']),
|
43 |
+
/*$2%s*/ esc_attr($item['term_id'])
|
44 |
);
|
45 |
}
|
46 |
|
polylang-de_DE.mo
CHANGED
Binary file
|
polylang-de_DE.po
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-10-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
@@ -17,8 +17,8 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPath-0: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang\n"
|
18 |
|
19 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:6
|
20 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
21 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
22 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
23 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:3
|
24 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
@@ -39,31 +39,39 @@ msgstr "Zeige die Sprachenliste"
|
|
39 |
msgid "Language Switcher"
|
40 |
msgstr "Sprachenliste"
|
41 |
|
42 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
43 |
msgid "Settings"
|
44 |
msgstr "Einstellungen"
|
45 |
|
46 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
47 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
48 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
49 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
50 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:14
|
51 |
msgid "Languages"
|
52 |
msgstr "Sprachen"
|
53 |
|
54 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
55 |
msgid "Show all languages"
|
56 |
msgstr "Zeige alle Sprachen"
|
57 |
|
58 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
59 |
msgid "Theme locations and languages"
|
60 |
msgstr "Anordnung im Theme und Sprachen"
|
61 |
|
62 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
63 |
#, php-format
|
64 |
msgid "Please go to the %slanguages page%s to set theme locations and languages"
|
65 |
msgstr "Du solltest zu der %sSprachen Seite%s gehen, um Anordnung im Theme und Sprachen zu definieren."
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
68 |
msgid "Page's language:"
|
69 |
msgstr "Sprache für die Seite :"
|
@@ -82,14 +90,14 @@ msgid "Translation"
|
|
82 |
msgstr "Übersetzung"
|
83 |
|
84 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
85 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:
|
86 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
87 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:7
|
88 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:21
|
89 |
msgid "Edit"
|
90 |
msgstr "Bearbeiten"
|
91 |
|
92 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:
|
93 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
94 |
msgid "Add new"
|
95 |
msgstr "Hinzufügen"
|
@@ -146,36 +154,36 @@ msgstr "2 Buchstaben ISO 639-1 sprache code (beispielweise : de)"
|
|
146 |
msgid "Update"
|
147 |
msgstr "Aktualisieren"
|
148 |
|
149 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
150 |
msgid "Menus"
|
151 |
msgstr "Menüs"
|
152 |
|
153 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
154 |
msgid "Theme location"
|
155 |
msgstr "Anordnung im Theme"
|
156 |
|
157 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
158 |
msgid "Options"
|
159 |
msgstr "Einstellungen"
|
160 |
|
161 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
162 |
msgid "Keep /language/ in pretty permalinks"
|
163 |
msgstr "/language/ in Permalinks behalten"
|
164 |
|
165 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
166 |
msgid "Remove /language/ in pretty permalinks"
|
167 |
msgstr "/language/ in Permalinks entfernen"
|
168 |
|
169 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
170 |
#, fuzzy
|
171 |
msgid "The front page default language is : "
|
172 |
msgstr "Die Sprache für die Startseite ist :"
|
173 |
|
174 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
175 |
msgid "set by the browser preference"
|
176 |
msgstr "durch den Browser Einstellung definiert"
|
177 |
|
178 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
179 |
msgid "otherwise: "
|
180 |
msgstr "sonst :"
|
181 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-06 13:58+0100\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
17 |
"X-Poedit-SearchPath-0: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang\n"
|
18 |
|
19 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:6
|
20 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:270
|
21 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:445
|
22 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
23 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:3
|
24 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
39 |
msgid "Language Switcher"
|
40 |
msgstr "Sprachenliste"
|
41 |
|
42 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:86
|
43 |
msgid "Settings"
|
44 |
msgstr "Einstellungen"
|
45 |
|
46 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:93
|
47 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:315
|
48 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:316
|
49 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
50 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:14
|
51 |
msgid "Languages"
|
52 |
msgstr "Sprachen"
|
53 |
|
54 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:306
|
55 |
msgid "Show all languages"
|
56 |
msgstr "Zeige alle Sprachen"
|
57 |
|
58 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:541
|
59 |
msgid "Theme locations and languages"
|
60 |
msgstr "Anordnung im Theme und Sprachen"
|
61 |
|
62 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:546
|
63 |
#, php-format
|
64 |
msgid "Please go to the %slanguages page%s to set theme locations and languages"
|
65 |
msgstr "Du solltest zu der %sSprachen Seite%s gehen, um Anordnung im Theme und Sprachen zu definieren."
|
66 |
|
67 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:557
|
68 |
+
msgid "The widget is displayed for:"
|
69 |
+
msgstr "Zeigen das Widget für :"
|
70 |
+
|
71 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:558
|
72 |
+
msgid "All languages"
|
73 |
+
msgstr "Alle Sprachen"
|
74 |
+
|
75 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
76 |
msgid "Page's language:"
|
77 |
msgstr "Sprache für die Seite :"
|
90 |
msgstr "Übersetzung"
|
91 |
|
92 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
93 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:65
|
94 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
95 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:7
|
96 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:21
|
97 |
msgid "Edit"
|
98 |
msgstr "Bearbeiten"
|
99 |
|
100 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:57
|
101 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
102 |
msgid "Add new"
|
103 |
msgstr "Hinzufügen"
|
154 |
msgid "Update"
|
155 |
msgstr "Aktualisieren"
|
156 |
|
157 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:78
|
158 |
msgid "Menus"
|
159 |
msgstr "Menüs"
|
160 |
|
161 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:86
|
162 |
msgid "Theme location"
|
163 |
msgstr "Anordnung im Theme"
|
164 |
|
165 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:122
|
166 |
msgid "Options"
|
167 |
msgstr "Einstellungen"
|
168 |
|
169 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:132
|
170 |
msgid "Keep /language/ in pretty permalinks"
|
171 |
msgstr "/language/ in Permalinks behalten"
|
172 |
|
173 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:138
|
174 |
msgid "Remove /language/ in pretty permalinks"
|
175 |
msgstr "/language/ in Permalinks entfernen"
|
176 |
|
177 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:143
|
178 |
#, fuzzy
|
179 |
msgid "The front page default language is : "
|
180 |
msgstr "Die Sprache für die Startseite ist :"
|
181 |
|
182 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:145
|
183 |
msgid "set by the browser preference"
|
184 |
msgstr "durch den Browser Einstellung definiert"
|
185 |
|
186 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:146
|
187 |
msgid "otherwise: "
|
188 |
msgstr "sonst :"
|
189 |
|
polylang-fr_FR.mo
CHANGED
Binary file
|
polylang-fr_FR.po
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-10-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
@@ -17,8 +17,8 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPath-0: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang\n"
|
18 |
|
19 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:6
|
20 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
21 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
22 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
23 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:3
|
24 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
@@ -39,31 +39,39 @@ msgstr "Affiche la liste des langues "
|
|
39 |
msgid "Language Switcher"
|
40 |
msgstr "Liste des langues"
|
41 |
|
42 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
43 |
msgid "Settings"
|
44 |
msgstr "Réglages"
|
45 |
|
46 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
47 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
48 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
49 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
50 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:14
|
51 |
msgid "Languages"
|
52 |
msgstr "Langues"
|
53 |
|
54 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
55 |
msgid "Show all languages"
|
56 |
msgstr "Afficher toutes les langues"
|
57 |
|
58 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
59 |
msgid "Theme locations and languages"
|
60 |
msgstr "Emplacements du thème et langues"
|
61 |
|
62 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
63 |
#, php-format
|
64 |
msgid "Please go to the %slanguages page%s to set theme locations and languages"
|
65 |
msgstr "Aller à la %spage langues%s pour définir les emplacements du thème et les langues "
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
68 |
msgid "Page's language:"
|
69 |
msgstr "Langue de la page"
|
@@ -82,14 +90,14 @@ msgid "Translation"
|
|
82 |
msgstr "Traduction"
|
83 |
|
84 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
85 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:
|
86 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
87 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:7
|
88 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:21
|
89 |
msgid "Edit"
|
90 |
msgstr "Modifier"
|
91 |
|
92 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:
|
93 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
94 |
msgid "Add new"
|
95 |
msgstr "Ajouter"
|
@@ -146,35 +154,35 @@ msgstr "Code ISO 639-1 à 2 lettres (par exemple : fr)"
|
|
146 |
msgid "Update"
|
147 |
msgstr "Mettre à jour"
|
148 |
|
149 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
150 |
msgid "Menus"
|
151 |
msgstr "Menus"
|
152 |
|
153 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
154 |
msgid "Theme location"
|
155 |
msgstr "Emplacement du thème"
|
156 |
|
157 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
158 |
msgid "Options"
|
159 |
msgstr "Options"
|
160 |
|
161 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
162 |
msgid "Keep /language/ in pretty permalinks"
|
163 |
msgstr "Conserve /language/ dans les permaliens"
|
164 |
|
165 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
166 |
msgid "Remove /language/ in pretty permalinks"
|
167 |
msgstr "Supprime /language/ dans les permaliens"
|
168 |
|
169 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
170 |
msgid "The front page default language is : "
|
171 |
msgstr "La langue par défaut de la page d'accueil est :"
|
172 |
|
173 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
174 |
msgid "set by the browser preference"
|
175 |
msgstr "définie par les préférences du navigateur"
|
176 |
|
177 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
178 |
msgid "otherwise: "
|
179 |
msgstr "sinon :"
|
180 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-06 14:02+0100\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
17 |
"X-Poedit-SearchPath-0: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang\n"
|
18 |
|
19 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:6
|
20 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:270
|
21 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:445
|
22 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
23 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:3
|
24 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
39 |
msgid "Language Switcher"
|
40 |
msgstr "Liste des langues"
|
41 |
|
42 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:86
|
43 |
msgid "Settings"
|
44 |
msgstr "Réglages"
|
45 |
|
46 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:93
|
47 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:315
|
48 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:316
|
49 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
50 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:14
|
51 |
msgid "Languages"
|
52 |
msgstr "Langues"
|
53 |
|
54 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:306
|
55 |
msgid "Show all languages"
|
56 |
msgstr "Afficher toutes les langues"
|
57 |
|
58 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:541
|
59 |
msgid "Theme locations and languages"
|
60 |
msgstr "Emplacements du thème et langues"
|
61 |
|
62 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:546
|
63 |
#, php-format
|
64 |
msgid "Please go to the %slanguages page%s to set theme locations and languages"
|
65 |
msgstr "Aller à la %spage langues%s pour définir les emplacements du thème et les langues "
|
66 |
|
67 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:557
|
68 |
+
msgid "The widget is displayed for:"
|
69 |
+
msgstr "Afficher le widget pour :"
|
70 |
+
|
71 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:558
|
72 |
+
msgid "All languages"
|
73 |
+
msgstr "Toutes les langues"
|
74 |
+
|
75 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
76 |
msgid "Page's language:"
|
77 |
msgstr "Langue de la page"
|
90 |
msgstr "Traduction"
|
91 |
|
92 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
93 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:65
|
94 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
95 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:7
|
96 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:21
|
97 |
msgid "Edit"
|
98 |
msgstr "Modifier"
|
99 |
|
100 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:57
|
101 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
102 |
msgid "Add new"
|
103 |
msgstr "Ajouter"
|
154 |
msgid "Update"
|
155 |
msgstr "Mettre à jour"
|
156 |
|
157 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:78
|
158 |
msgid "Menus"
|
159 |
msgstr "Menus"
|
160 |
|
161 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:86
|
162 |
msgid "Theme location"
|
163 |
msgstr "Emplacement du thème"
|
164 |
|
165 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:122
|
166 |
msgid "Options"
|
167 |
msgstr "Options"
|
168 |
|
169 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:132
|
170 |
msgid "Keep /language/ in pretty permalinks"
|
171 |
msgstr "Conserve /language/ dans les permaliens"
|
172 |
|
173 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:138
|
174 |
msgid "Remove /language/ in pretty permalinks"
|
175 |
msgstr "Supprime /language/ dans les permaliens"
|
176 |
|
177 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:143
|
178 |
msgid "The front page default language is : "
|
179 |
msgstr "La langue par défaut de la page d'accueil est :"
|
180 |
|
181 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:145
|
182 |
msgid "set by the browser preference"
|
183 |
msgstr "définie par les préférences du navigateur"
|
184 |
|
185 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:146
|
186 |
msgid "otherwise: "
|
187 |
msgstr "sinon :"
|
188 |
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/polylang/
|
5 |
-
Version: 0.
|
6 |
Author: F. Demarle
|
7 |
Description: Adds multilingual capability to Wordpress
|
8 |
*/
|
@@ -23,7 +23,7 @@ Description: Adds multilingual capability to Wordpress
|
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
|
26 |
-
define('POLYLANG_VERSION', '0.
|
27 |
define('POLYLANG_DIR', dirname(__FILE__));
|
28 |
require_once(POLYLANG_DIR.'/base.php');
|
29 |
require_once(POLYLANG_DIR.'/admin.php');
|
@@ -95,9 +95,12 @@ class Polylang extends Polylang_Base {
|
|
95 |
add_filter('get_previous_post_where', array(&$this, 'posts_where'));
|
96 |
add_filter('get_next_post_where', array(&$this, 'posts_where'));
|
97 |
|
98 |
-
// filters the nav menus according to current language
|
99 |
add_filter('wp_nav_menu_args', array(&$this, 'wp_nav_menu_args'));
|
100 |
|
|
|
|
|
|
|
101 |
// allows a new value for the 'show' parameter to display the homepage url according to the current language
|
102 |
add_filter('bloginfo_url', array(&$this, 'bloginfo_url'), 10, 2);
|
103 |
|
@@ -258,9 +261,8 @@ class Polylang extends Polylang_Base {
|
|
258 |
// adds our clauses to filter by current language
|
259 |
if ($this->curlang) {
|
260 |
global $wpdb;
|
261 |
-
$value = $this->curlang->term_id;
|
262 |
$clauses['join'] .= " INNER JOIN $wpdb->termmeta AS tm ON t.term_id = tm.term_id";
|
263 |
-
$clauses['where'] .= " AND tm.meta_key = '_language' AND tm.meta_value = $
|
264 |
}
|
265 |
return $clauses;
|
266 |
}
|
@@ -282,7 +284,8 @@ class Polylang extends Polylang_Base {
|
|
282 |
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
283 |
|
284 |
if (count($lang_parse[1])) {
|
285 |
-
|
|
|
286 |
// set default to 1 for any without q factor
|
287 |
foreach ($accept_langs as $accept_lang => $val) {
|
288 |
if ($val === '') $accept_langs[$accept_lang] = 1;
|
@@ -409,18 +412,16 @@ class Polylang extends Polylang_Base {
|
|
409 |
}
|
410 |
}
|
411 |
}
|
412 |
-
|
413 |
$qvars = $query->query_vars;
|
414 |
|
415 |
// filters recent posts to the current language
|
416 |
// FIXME if $qvars['post_type'] == 'nav_menu_item', setting lang breaks custom menus.
|
417 |
// since to get nav_menu_items, get_post is used and no language is linked to nav_menu_items
|
418 |
-
// (even if the object behind the nav_menu_item is linked to a language)
|
419 |
if ($query->is_home && $this->curlang && !isset($qvars['post_type']))
|
420 |
$query->set('lang', $this->curlang->slug);
|
421 |
|
422 |
-
// remove pages
|
423 |
-
if (isset($qvars['
|
424 |
$query->set('post_type', 'post');
|
425 |
}
|
426 |
|
@@ -438,12 +439,13 @@ class Polylang extends Polylang_Base {
|
|
438 |
}
|
439 |
|
440 |
// outputs references to translated pages (if exists) in the html head section
|
|
|
441 |
$listlanguages = $this->get_languages_list();
|
442 |
foreach ($listlanguages as $language) {
|
443 |
if ($language->slug != $this->curlang->slug) {
|
444 |
$url = $this->get_translation_url($language);
|
445 |
if ($url)
|
446 |
-
|
447 |
}
|
448 |
}
|
449 |
}
|
@@ -481,7 +483,7 @@ class Polylang extends Polylang_Base {
|
|
481 |
// don't use directly e[0] just in case there is somewhere else an element named 's'
|
482 |
// check before if the hidden input has not already been introduced by get_search_form
|
483 |
if (!$this->search_form_filter) {
|
484 |
-
$lang = $this->curlang->slug;
|
485 |
$js .= "e = document.getElementsByName('s');
|
486 |
for (i = 0; i < e.length; i++) {
|
487 |
if (e[i] == '[object HTMLInputElement]') {
|
@@ -504,23 +506,20 @@ class Polylang extends Polylang_Base {
|
|
504 |
function get_search_form($form) {
|
505 |
if ($form) {
|
506 |
$this->search_form_filter = true;
|
507 |
-
$form = str_replace('</form>', '<input type="hidden" name="lang" value="'
|
508 |
}
|
509 |
return $form;
|
510 |
}
|
511 |
|
512 |
// filters the list of pages according to the current language
|
513 |
-
//
|
514 |
// cannot play with widget_pages_args filter either as it seems that get_pages does not query taxonomies :(
|
515 |
-
//
|
516 |
function get_pages($pages, $r) {
|
517 |
if (isset($this->curlang)) {
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
unset($pages[$key]);
|
522 |
-
}
|
523 |
-
}
|
524 |
return $pages;
|
525 |
}
|
526 |
|
@@ -528,10 +527,9 @@ class Polylang extends Polylang_Base {
|
|
528 |
function comments_clauses($clauses) {
|
529 |
if ($this->curlang) {
|
530 |
global $wpdb;
|
531 |
-
$value = $this->curlang->term_id;
|
532 |
$clauses['join'] .= " INNER JOIN $wpdb->term_relationships AS tr ON tr.object_id = ID";
|
533 |
$clauses['join'] .= " INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
|
534 |
-
$clauses['where'] .= " AND tt.term_id = $
|
535 |
}
|
536 |
return $clauses;
|
537 |
}
|
@@ -546,11 +544,11 @@ class Polylang extends Polylang_Base {
|
|
546 |
if ($wp_rewrite->using_permalinks()) {
|
547 |
$home = home_url();
|
548 |
$options['rewrite'] ? $base = '/' : $base = '/language/';
|
549 |
-
$url = str_replace($home, $home.$base.$this->curlang->slug, $url);
|
550 |
}
|
551 |
else {
|
552 |
if ($feed)
|
553 |
-
$url = home_url('?lang='.$this->curlang->slug.'&feed='.$feed);
|
554 |
}
|
555 |
}
|
556 |
return $url;
|
@@ -569,8 +567,7 @@ class Polylang extends Polylang_Base {
|
|
569 |
function posts_where($sql) {
|
570 |
if ($this->curlang) {
|
571 |
global $wpdb;
|
572 |
-
$
|
573 |
-
$sql .= " AND term_taxonomy_id = $lang_id";
|
574 |
}
|
575 |
return $sql;
|
576 |
}
|
@@ -583,10 +580,10 @@ class Polylang extends Polylang_Base {
|
|
583 |
$home = home_url();
|
584 |
if ($wp_rewrite->using_permalinks()) {
|
585 |
$options['rewrite'] ? $base = '/' : $base = '/language/';
|
586 |
-
$link_html = str_replace($home, $home.$base.$this->curlang->slug, $link_html);
|
587 |
}
|
588 |
else
|
589 |
-
$link_html = str_replace($home.'/?', $home.'/?lang='.$this->curlang->slug.'&', $link_html);
|
590 |
}
|
591 |
return $link_html;
|
592 |
}
|
@@ -637,14 +634,25 @@ class Polylang extends Polylang_Base {
|
|
637 |
return isset($url) ? $url : null;
|
638 |
}
|
639 |
|
640 |
-
// filters the nav menus according to current language
|
641 |
function wp_nav_menu_args($args) {
|
642 |
if (!$args['menu'] && $args['theme_location'] && $this->curlang) {
|
643 |
$menu_lang = get_option('polylang_nav_menus');
|
644 |
$args['menu'] = $menu_lang[$args['theme_location']][$this->curlang->slug];
|
645 |
}
|
646 |
return $args;
|
647 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
|
649 |
// returns the home url in the right language
|
650 |
function get_home_url($language) {
|
@@ -677,7 +685,7 @@ class Polylang extends Polylang_Base {
|
|
677 |
$url = $this->get_translation_url($language);
|
678 |
if (!isset($url))
|
679 |
$url = $this->get_home_url($language); // if the page is not translated, link to the home page
|
680 |
-
$output .= "<li><a href='$url'>"
|
681 |
}
|
682 |
$output .= "</ul>\n";
|
683 |
echo $output;
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/polylang/
|
5 |
+
Version: 0.3
|
6 |
Author: F. Demarle
|
7 |
Description: Adds multilingual capability to Wordpress
|
8 |
*/
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
|
26 |
+
define('POLYLANG_VERSION', '0.3');
|
27 |
define('POLYLANG_DIR', dirname(__FILE__));
|
28 |
require_once(POLYLANG_DIR.'/base.php');
|
29 |
require_once(POLYLANG_DIR.'/admin.php');
|
95 |
add_filter('get_previous_post_where', array(&$this, 'posts_where'));
|
96 |
add_filter('get_next_post_where', array(&$this, 'posts_where'));
|
97 |
|
98 |
+
// filters the nav menus according to the current language
|
99 |
add_filter('wp_nav_menu_args', array(&$this, 'wp_nav_menu_args'));
|
100 |
|
101 |
+
// filters the widgets according to the current language
|
102 |
+
add_filter('widget_display_callback', array(&$this, 'widget_display_callback'), 10, 3);
|
103 |
+
|
104 |
// allows a new value for the 'show' parameter to display the homepage url according to the current language
|
105 |
add_filter('bloginfo_url', array(&$this, 'bloginfo_url'), 10, 2);
|
106 |
|
261 |
// adds our clauses to filter by current language
|
262 |
if ($this->curlang) {
|
263 |
global $wpdb;
|
|
|
264 |
$clauses['join'] .= " INNER JOIN $wpdb->termmeta AS tm ON t.term_id = tm.term_id";
|
265 |
+
$clauses['where'] .= $wpdb->prepare(" AND tm.meta_key = '_language' AND tm.meta_value = %d", $this->curlang->term_id);
|
266 |
}
|
267 |
return $clauses;
|
268 |
}
|
284 |
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
|
285 |
|
286 |
if (count($lang_parse[1])) {
|
287 |
+
// NOTE: array_combine => PHP5
|
288 |
+
$accept_langs = array_combine($lang_parse[1], $lang_parse[4]); // create a list like "en" => 0.8
|
289 |
// set default to 1 for any without q factor
|
290 |
foreach ($accept_langs as $accept_lang => $val) {
|
291 |
if ($val === '') $accept_langs[$accept_lang] = 1;
|
412 |
}
|
413 |
}
|
414 |
}
|
|
|
415 |
$qvars = $query->query_vars;
|
416 |
|
417 |
// filters recent posts to the current language
|
418 |
// FIXME if $qvars['post_type'] == 'nav_menu_item', setting lang breaks custom menus.
|
419 |
// since to get nav_menu_items, get_post is used and no language is linked to nav_menu_items
|
|
|
420 |
if ($query->is_home && $this->curlang && !isset($qvars['post_type']))
|
421 |
$query->set('lang', $this->curlang->slug);
|
422 |
|
423 |
+
// remove pages query when the language is set
|
424 |
+
if (isset($qvars['lang']) && $qvars['lang'] && !isset($qvars['post_type']))
|
425 |
$query->set('post_type', 'post');
|
426 |
}
|
427 |
|
439 |
}
|
440 |
|
441 |
// outputs references to translated pages (if exists) in the html head section
|
442 |
+
// FIXME improve this to make only one db query
|
443 |
$listlanguages = $this->get_languages_list();
|
444 |
foreach ($listlanguages as $language) {
|
445 |
if ($language->slug != $this->curlang->slug) {
|
446 |
$url = $this->get_translation_url($language);
|
447 |
if ($url)
|
448 |
+
printf("<link hreflang='%s' href='%s' rel='alternate' />\n", esc_attr($language->slug), $url);
|
449 |
}
|
450 |
}
|
451 |
}
|
483 |
// don't use directly e[0] just in case there is somewhere else an element named 's'
|
484 |
// check before if the hidden input has not already been introduced by get_search_form
|
485 |
if (!$this->search_form_filter) {
|
486 |
+
$lang = esc_js($this->curlang->slug);
|
487 |
$js .= "e = document.getElementsByName('s');
|
488 |
for (i = 0; i < e.length; i++) {
|
489 |
if (e[i] == '[object HTMLInputElement]') {
|
506 |
function get_search_form($form) {
|
507 |
if ($form) {
|
508 |
$this->search_form_filter = true;
|
509 |
+
$form = str_replace('</form>', '<input type="hidden" name="lang" value="'.esc_attr($this->curlang->slug).'" /></form>', $form);
|
510 |
}
|
511 |
return $form;
|
512 |
}
|
513 |
|
514 |
// filters the list of pages according to the current language
|
515 |
+
// it seems that there is currently no way to filter before the database query (3.2)
|
516 |
// cannot play with widget_pages_args filter either as it seems that get_pages does not query taxonomies :(
|
517 |
+
// so redo the query with get_posts and the 'lang' parameter seems to be be the current best way (rather than trying to manipulate $pages)
|
518 |
function get_pages($pages, $r) {
|
519 |
if (isset($this->curlang)) {
|
520 |
+
$r['lang'] = $this->curlang->slug;
|
521 |
+
$pages = get_posts($r);
|
522 |
+
}
|
|
|
|
|
|
|
523 |
return $pages;
|
524 |
}
|
525 |
|
527 |
function comments_clauses($clauses) {
|
528 |
if ($this->curlang) {
|
529 |
global $wpdb;
|
|
|
530 |
$clauses['join'] .= " INNER JOIN $wpdb->term_relationships AS tr ON tr.object_id = ID";
|
531 |
$clauses['join'] .= " INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
|
532 |
+
$clauses['where'] .= $wpdb->prepare(" AND tt.term_id = %d", $this->curlang->term_id);
|
533 |
}
|
534 |
return $clauses;
|
535 |
}
|
544 |
if ($wp_rewrite->using_permalinks()) {
|
545 |
$home = home_url();
|
546 |
$options['rewrite'] ? $base = '/' : $base = '/language/';
|
547 |
+
$url = esc_url(str_replace($home, $home.$base.$this->curlang->slug, $url));
|
548 |
}
|
549 |
else {
|
550 |
if ($feed)
|
551 |
+
$url = esc_url(home_url('?lang='.$this->curlang->slug.'&feed='.$feed));
|
552 |
}
|
553 |
}
|
554 |
return $url;
|
567 |
function posts_where($sql) {
|
568 |
if ($this->curlang) {
|
569 |
global $wpdb;
|
570 |
+
$sql .= $wpdb->prepare(" AND term_taxonomy_id = %d", $this->curlang->term_id);
|
|
|
571 |
}
|
572 |
return $sql;
|
573 |
}
|
580 |
$home = home_url();
|
581 |
if ($wp_rewrite->using_permalinks()) {
|
582 |
$options['rewrite'] ? $base = '/' : $base = '/language/';
|
583 |
+
$link_html = esc_url(str_replace($home, $home.$base.$this->curlang->slug, $link_html));
|
584 |
}
|
585 |
else
|
586 |
+
$link_html = esc_url(str_replace($home.'/?', $home.'/?lang='.$this->curlang->slug.'&', $link_html));
|
587 |
}
|
588 |
return $link_html;
|
589 |
}
|
634 |
return isset($url) ? $url : null;
|
635 |
}
|
636 |
|
637 |
+
// filters the nav menus according to the current language
|
638 |
function wp_nav_menu_args($args) {
|
639 |
if (!$args['menu'] && $args['theme_location'] && $this->curlang) {
|
640 |
$menu_lang = get_option('polylang_nav_menus');
|
641 |
$args['menu'] = $menu_lang[$args['theme_location']][$this->curlang->slug];
|
642 |
}
|
643 |
return $args;
|
644 |
+
}
|
645 |
+
|
646 |
+
// filters the widgets according to the current language
|
647 |
+
function widget_display_callback($instance, $widget, $args) {
|
648 |
+
if (isset($this->curlang)) {
|
649 |
+
$widget_lang = get_option('polylang_widgets');
|
650 |
+
// don't display if a language filter is set and this is not the current one
|
651 |
+
if (isset($widget_lang[$widget->id]) && $widget_lang[$widget->id] && $widget_lang[$widget->id] != $this->curlang->slug)
|
652 |
+
return false;
|
653 |
+
}
|
654 |
+
return true;
|
655 |
+
}
|
656 |
|
657 |
// returns the home url in the right language
|
658 |
function get_home_url($language) {
|
685 |
$url = $this->get_translation_url($language);
|
686 |
if (!isset($url))
|
687 |
$url = $this->get_home_url($language); // if the page is not translated, link to the home page
|
688 |
+
$output .= "<li><a href='$url'>".esc_attr($language->name)."</a></li>\n";
|
689 |
}
|
690 |
$output .= "</ul>\n";
|
691 |
echo $output;
|
polylang.pot
CHANGED
@@ -2,7 +2,7 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2011-10-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
@@ -17,8 +17,8 @@ msgstr ""
|
|
17 |
"X-Poedit-SearchPath-0: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang\n"
|
18 |
|
19 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:6
|
20 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
21 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
22 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
23 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:3
|
24 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
@@ -39,31 +39,39 @@ msgstr ""
|
|
39 |
msgid "Language Switcher"
|
40 |
msgstr ""
|
41 |
|
42 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
43 |
msgid "Settings"
|
44 |
msgstr ""
|
45 |
|
46 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
47 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
48 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
49 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
50 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:14
|
51 |
msgid "Languages"
|
52 |
msgstr ""
|
53 |
|
54 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
55 |
msgid "Show all languages"
|
56 |
msgstr ""
|
57 |
|
58 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
59 |
msgid "Theme locations and languages"
|
60 |
msgstr ""
|
61 |
|
62 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
63 |
#, php-format
|
64 |
msgid "Please go to the %slanguages page%s to set theme locations and languages"
|
65 |
msgstr ""
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
68 |
msgid "Page's language:"
|
69 |
msgstr ""
|
@@ -82,14 +90,14 @@ msgid "Translation"
|
|
82 |
msgstr ""
|
83 |
|
84 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
85 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:
|
86 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
87 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:7
|
88 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:21
|
89 |
msgid "Edit"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:
|
93 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
94 |
msgid "Add new"
|
95 |
msgstr ""
|
@@ -145,35 +153,35 @@ msgstr ""
|
|
145 |
msgid "Update"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
149 |
msgid "Menus"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
153 |
msgid "Theme location"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
157 |
msgid "Options"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
161 |
msgid "Keep /language/ in pretty permalinks"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
165 |
msgid "Remove /language/ in pretty permalinks"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
169 |
msgid "The front page default language is : "
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
173 |
msgid "set by the browser preference"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
177 |
msgid "otherwise: "
|
178 |
msgstr ""
|
179 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-06 13:58+0100\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
17 |
"X-Poedit-SearchPath-0: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang\n"
|
18 |
|
19 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:6
|
20 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:270
|
21 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:445
|
22 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
23 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:3
|
24 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
39 |
msgid "Language Switcher"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:86
|
43 |
msgid "Settings"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:93
|
47 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:315
|
48 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:316
|
49 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
50 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:14
|
51 |
msgid "Languages"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:306
|
55 |
msgid "Show all languages"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:541
|
59 |
msgid "Theme locations and languages"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:546
|
63 |
#, php-format
|
64 |
msgid "Please go to the %slanguages page%s to set theme locations and languages"
|
65 |
msgstr ""
|
66 |
|
67 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:557
|
68 |
+
msgid "The widget is displayed for:"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:558
|
72 |
+
msgid "All languages"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
76 |
msgid "Page's language:"
|
77 |
msgstr ""
|
90 |
msgstr ""
|
91 |
|
92 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
93 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:65
|
94 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
95 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:7
|
96 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:21
|
97 |
msgid "Edit"
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:57
|
101 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
102 |
msgid "Add new"
|
103 |
msgstr ""
|
153 |
msgid "Update"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:78
|
157 |
msgid "Menus"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:86
|
161 |
msgid "Theme location"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:122
|
165 |
msgid "Options"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:132
|
169 |
msgid "Keep /language/ in pretty permalinks"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:138
|
173 |
msgid "Remove /language/ in pretty permalinks"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:143
|
177 |
msgid "The front page default language is : "
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:145
|
181 |
msgid "set by the browser preference"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:146
|
185 |
msgid "otherwise: "
|
186 |
msgstr ""
|
187 |
|
post-metabox.php
CHANGED
@@ -3,9 +3,14 @@
|
|
3 |
<p><em><?php $post_type == 'page' ? _e('Page\'s language:', 'polylang') : _e('Post\'s language:', 'polylang');?></em></p>
|
4 |
<p>
|
5 |
<select name="post_lang_choice" id="post_lang_choice" class="tags-input">
|
6 |
-
<option value=""></option> <?php
|
7 |
foreach ($listlanguages as $language) {
|
8 |
-
printf(
|
|
|
|
|
|
|
|
|
|
|
9 |
} ?>
|
10 |
</select><br />
|
11 |
</p>
|
3 |
<p><em><?php $post_type == 'page' ? _e('Page\'s language:', 'polylang') : _e('Post\'s language:', 'polylang');?></em></p>
|
4 |
<p>
|
5 |
<select name="post_lang_choice" id="post_lang_choice" class="tags-input">
|
6 |
+
<option value="0"></option> <?php
|
7 |
foreach ($listlanguages as $language) {
|
8 |
+
printf(
|
9 |
+
"<option value='%s'%s>%s</option>\n",
|
10 |
+
esc_attr($language->slug),
|
11 |
+
$language == $lang ? ' selected="selected"' : '',
|
12 |
+
esc_attr($language->name)
|
13 |
+
);
|
14 |
} ?>
|
15 |
</select><br />
|
16 |
</p>
|
post-translations.php
CHANGED
@@ -14,12 +14,25 @@
|
|
14 |
if (isset($_GET['from_post']))
|
15 |
$value = $this->get_post($_GET['from_post'], $language); ?>
|
16 |
<tr>
|
17 |
-
<td style="font-size: 11px;"><?php echo $language->name;?></td><?php
|
18 |
-
printf(
|
|
|
|
|
|
|
|
|
|
|
19 |
if ($lang) {
|
20 |
$link = $value ?
|
21 |
-
sprintf(
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
<td style="font-size: 11px;"><?php echo $link ?><td><?php
|
24 |
}?>
|
25 |
</tr><?php
|
14 |
if (isset($_GET['from_post']))
|
15 |
$value = $this->get_post($_GET['from_post'], $language); ?>
|
16 |
<tr>
|
17 |
+
<td style="font-size: 11px;"><?php echo esc_attr($language->name);?></td><?php
|
18 |
+
printf(
|
19 |
+
'<td><input name="%s" id="%s" class="tags-input" type="text" value="%s" size="6"/></td>',
|
20 |
+
esc_attr($language->slug),
|
21 |
+
esc_attr($language->slug),
|
22 |
+
esc_attr($value)
|
23 |
+
);
|
24 |
if ($lang) {
|
25 |
$link = $value ?
|
26 |
+
sprintf(
|
27 |
+
'<a href="%s">%s</a>',
|
28 |
+
esc_url(admin_url('post.php?action=edit&post=' . $value)),
|
29 |
+
__('Edit','polylang')
|
30 |
+
) :
|
31 |
+
sprintf(
|
32 |
+
'<a href="%s">%s</a>',
|
33 |
+
esc_url(admin_url('post-new.php?from_post='. $post_ID . '&new_lang=' .$language->slug)),
|
34 |
+
__('Add new','polylang')
|
35 |
+
);?>
|
36 |
<td style="font-size: 11px;"><?php echo $link ?><td><?php
|
37 |
}?>
|
38 |
</tr><?php
|
readme.txt
CHANGED
@@ -3,15 +3,15 @@ Contributors: Chouby
|
|
3 |
Tags: bilingual, multilingual, language, i18n, l10n, international, translate, translation, widget
|
4 |
Requires at least: 3.1
|
5 |
Tested up to: 3.2.1
|
6 |
-
Stable tag: 0.
|
7 |
|
8 |
Adds multilingual support to WordPress.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
Polylang adds multilingual support to WordPress. It acts as a language filter for posts you have written in several languages. It will however not make the translation for you !
|
13 |
|
14 |
-
You write posts, pages and create categories and post tags as usual. You just have to define the language and it will be displayed only if the visitor is browsing this language. Optionaly, you can mark each post, page, category and post tag to be the translation of another one. Thus if, for example, your visitor is reading a post,
|
15 |
|
16 |
= Features =
|
17 |
|
@@ -22,12 +22,14 @@ You write posts, pages and create categories and post tags as usual. You just ha
|
|
22 |
* Support for pretty permalinks
|
23 |
* Support for static page (in the right language) used as front page
|
24 |
* The following widgets are automatically in the right language : archives, categories, pages, recent comments, recent posts, tag cloud (calendar not supported yet)
|
|
|
25 |
* Simple language switcher provided as a widget
|
26 |
* The plugin backend is currently available in English, French, German
|
27 |
|
28 |
= Notes =
|
29 |
|
30 |
* The tests have been made with WordPress 3.2.1 and with the Twenty Eleven theme (see FAQ). Although I did not test previous versions, I see no reason why it should not work with WordPress 3.1. However the plugin should not work with WordPress 3.0.5 and lower.
|
|
|
31 |
* Multisite has not been tested.
|
32 |
* You must deactivate other multilingual plugins before activating Polylang. Otherwise, you may get unexpected results !
|
33 |
* Unlike some other plugins, if you deactivate Polylang, your blog will go on working as smoothly as possible. All your posts, pages, category and post tags would be accessible (without language filter of course !).
|
@@ -87,6 +89,15 @@ You MUST define a language for all your categories and post tags otherwise they
|
|
87 |
|
88 |
== Changelog ==
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
= 0.2 =
|
91 |
|
92 |
* Add language filter for nav menus
|
@@ -97,6 +108,9 @@ You MUST define a language for all your categories and post tags otherwise they
|
|
97 |
* Improved performance for filtering terms by language
|
98 |
* Bugs correction
|
99 |
|
|
|
|
|
100 |
= 0.1 =
|
101 |
* Initial release
|
102 |
|
|
3 |
Tags: bilingual, multilingual, language, i18n, l10n, international, translate, translation, widget
|
4 |
Requires at least: 3.1
|
5 |
Tested up to: 3.2.1
|
6 |
+
Stable tag: 0.3
|
7 |
|
8 |
Adds multilingual support to WordPress.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
Polylang adds multilingual support to WordPress. It acts as a language filter for posts you have written in several languages. It will however not make the translation for you ! If you are looking for automatic translation, look for another plugin. Unlike some other plugins, it does not integrate professionnal translation.
|
13 |
|
14 |
+
You write posts, pages and create categories and post tags as usual. You just have to define the language and it will be displayed only if the visitor is browsing this language. Optionaly, you can mark each post, page, category and post tag to be the translation of another one. Thus if, for example, your visitor is reading a post, he can switch (using the simple language switcher widget provided with the plugin) to the same post translated in another language (provided that you translated it !).
|
15 |
|
16 |
= Features =
|
17 |
|
22 |
* Support for pretty permalinks
|
23 |
* Support for static page (in the right language) used as front page
|
24 |
* The following widgets are automatically in the right language : archives, categories, pages, recent comments, recent posts, tag cloud (calendar not supported yet)
|
25 |
+
* All widgets can be displayed or not, depending on the language
|
26 |
* Simple language switcher provided as a widget
|
27 |
* The plugin backend is currently available in English, French, German
|
28 |
|
29 |
= Notes =
|
30 |
|
31 |
* The tests have been made with WordPress 3.2.1 and with the Twenty Eleven theme (see FAQ). Although I did not test previous versions, I see no reason why it should not work with WordPress 3.1. However the plugin should not work with WordPress 3.0.5 and lower.
|
32 |
+
* Your server must run PHP5
|
33 |
* Multisite has not been tested.
|
34 |
* You must deactivate other multilingual plugins before activating Polylang. Otherwise, you may get unexpected results !
|
35 |
* Unlike some other plugins, if you deactivate Polylang, your blog will go on working as smoothly as possible. All your posts, pages, category and post tags would be accessible (without language filter of course !).
|
89 |
|
90 |
== Changelog ==
|
91 |
|
92 |
+
= 0.3 =
|
93 |
+
|
94 |
+
* Add language filter for widgets
|
95 |
+
* Improved performance for filtering pages by language
|
96 |
+
* Improved security
|
97 |
+
* Minor bug correction with versions management
|
98 |
+
|
99 |
+
release: October 7th, 2011
|
100 |
+
|
101 |
= 0.2 =
|
102 |
|
103 |
* Add language filter for nav menus
|
108 |
* Improved performance for filtering terms by language
|
109 |
* Bugs correction
|
110 |
|
111 |
+
release: October 5th, 2011
|
112 |
+
|
113 |
= 0.1 =
|
114 |
* Initial release
|
115 |
|
116 |
+
release: September 22nd, 2011
|
term-translations.php
CHANGED
@@ -31,17 +31,17 @@ else { // add term form?>
|
|
31 |
$translation = get_term($translation_id, $taxonomy);
|
32 |
}?>
|
33 |
|
34 |
-
<tr><td style="padding: 0px"><?php echo $language->name;?></td><?php
|
35 |
|
36 |
// no translation exits in this language
|
37 |
if (!$translation) {
|
38 |
$translations = $this->get_terms_not_translated($taxonomy, $language, $lang);
|
39 |
if (!empty($translations)) { ?>
|
40 |
<td style="padding: 0px">
|
41 |
-
<select name="_lang-<?php echo $language->slug;?>" id="_lang-<?php echo $language->slug;?>" style="width: 15em">
|
42 |
<option value="0"></option><?php
|
43 |
foreach ($translations as $translation) { ?>
|
44 |
-
<option value="<?php echo $translation->term_id;?>"><?php echo $translation->name;?></option><?php
|
45 |
} ?>
|
46 |
</select>
|
47 |
</td><?php
|
@@ -52,17 +52,30 @@ else { // add term form?>
|
|
52 |
} ?>
|
53 |
<td style="padding: 0px"><?php
|
54 |
// do not display the add new link in add term form ($term_id not set !!!)
|
55 |
-
if (isset($term_id))
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
</td><?php
|
59 |
}
|
60 |
|
61 |
// a translation exists
|
62 |
else { ?>
|
63 |
-
<td style="padding: 0px"><?php echo $translation->name; ?></td>
|
64 |
-
<td style="padding: 0px"
|
65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
</td><?php
|
67 |
} ?>
|
68 |
</tr><?php
|
31 |
$translation = get_term($translation_id, $taxonomy);
|
32 |
}?>
|
33 |
|
34 |
+
<tr><td style="padding: 0px"><?php echo esc_attr($language->name);?></td><?php
|
35 |
|
36 |
// no translation exits in this language
|
37 |
if (!$translation) {
|
38 |
$translations = $this->get_terms_not_translated($taxonomy, $language, $lang);
|
39 |
if (!empty($translations)) { ?>
|
40 |
<td style="padding: 0px">
|
41 |
+
<select name="_lang-<?php echo esc_attr($language->slug);?>" id="_lang-<?php echo esc_attr($language->slug);?>" style="width: 15em">
|
42 |
<option value="0"></option><?php
|
43 |
foreach ($translations as $translation) { ?>
|
44 |
+
<option value="<?php echo esc_attr($translation->term_id);?>"><?php echo esc_attr($translation->name);?></option><?php
|
45 |
} ?>
|
46 |
</select>
|
47 |
</td><?php
|
52 |
} ?>
|
53 |
<td style="padding: 0px"><?php
|
54 |
// do not display the add new link in add term form ($term_id not set !!!)
|
55 |
+
if (isset($term_id)) {
|
56 |
+
$link = esc_url(admin_url(sprintf(
|
57 |
+
'edit-tags.php?taxonomy=%s&from_tag=%s&from_lang=%s&new_lang=%s',
|
58 |
+
$taxonomy,
|
59 |
+
$term_id,
|
60 |
+
$lang->slug,
|
61 |
+
$language->slug
|
62 |
+
)));
|
63 |
+
echo '<a href="' . $link . '">' . __('Add new','polylang') . '</a>';
|
64 |
+
}?>
|
65 |
</td><?php
|
66 |
}
|
67 |
|
68 |
// a translation exists
|
69 |
else { ?>
|
70 |
+
<td style="padding: 0px"><?php echo esc_attr($translation->name); ?></td>
|
71 |
+
<td style="padding: 0px"><?php
|
72 |
+
$link = esc_url(admin_url(sprintf(
|
73 |
+
'edit-tags.php?action=edit&taxonomy=%s&tag_ID=%s',
|
74 |
+
$taxonomy,
|
75 |
+
$translation->term_id
|
76 |
+
)));
|
77 |
+
echo '<a href="' . $link . '">' . __('Edit','polylang') . '</a>';
|
78 |
+
};?>
|
79 |
</td><?php
|
80 |
} ?>
|
81 |
</tr><?php
|
uninstall.php
CHANGED
@@ -34,5 +34,6 @@ if (!$count) {
|
|
34 |
// delete options
|
35 |
delete_option('polylang');
|
36 |
delete_option('polylang_nav_menus');
|
|
|
37 |
delete_option('widget_polylang_widget'); // automatically created by WP
|
38 |
?>
|
34 |
// delete options
|
35 |
delete_option('polylang');
|
36 |
delete_option('polylang_nav_menus');
|
37 |
+
delete_option('polylang_widgets');
|
38 |
delete_option('widget_polylang_widget'); // automatically created by WP
|
39 |
?>
|