Version Description
- Add language filter for nav menus
- Add German translation
- Add language filter for recent comments
- Add ajax to term edit form
- Add ajax to post metabox
- Improved performance for filtering terms by language
- Bugs correction
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 0.2 |
Comparing to | |
See all releases |
Code changes from version 0.1 to 0.2
- add-term-form.php +9 -4
- admin.js +30 -0
- admin.php +140 -48
- base.php +6 -7
- edit-term-form.php +9 -63
- languages-form.php +49 -4
- polylang-de_DE.mo +0 -0
- polylang-de_DE.po +192 -0
- polylang-fr_FR.mo +0 -0
- polylang-fr_FR.po +79 -60
- polylang.php +99 -62
- polylang.pot +190 -0
- post-metabox.php +13 -36
- post-translations.php +29 -0
- readme.txt +39 -13
- term-translations.php +75 -0
- uninstall.php +4 -2
add-term-form.php
CHANGED
@@ -1,11 +1,16 @@
|
|
1 |
<?php // adds a language select list in the Categories and Post tags admin panels ?>
|
2 |
<div class="form-field">
|
3 |
-
<label for="
|
4 |
-
<select name="
|
5 |
-
<option value="
|
6 |
foreach ($listlanguages as $language) {
|
7 |
-
printf("<option value='%s'
|
8 |
} ?>
|
9 |
</select>
|
10 |
<p><?php _e('Sets the language', 'polylang');?></p>
|
11 |
</div>
|
|
|
|
|
|
|
|
|
|
1 |
<?php // adds a language select list in the Categories and Post tags admin panels ?>
|
2 |
<div class="form-field">
|
3 |
+
<label for="term_lang_choice"><?php _e('Language', 'polylang');?></label>
|
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>
|
11 |
</div>
|
12 |
+
<div id="term-translations" class="form-field"><?php
|
13 |
+
// adds translation field if we already know the language
|
14 |
+
if (isset($_GET['from_tag']) && isset($_GET['from_lang']) && isset($_GET['new_lang']))
|
15 |
+
include(POLYLANG_DIR.'/term-translations.php');?>
|
16 |
+
</div>
|
admin.js
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
|
3 |
+
// ajax for post metabox
|
4 |
+
jQuery('#post_lang_choice').change( function() {
|
5 |
+
var data = {
|
6 |
+
action: 'post_lang_choice',
|
7 |
+
lang: jQuery(this).attr('value'),
|
8 |
+
post_id: jQuery('#post_ID').attr('value')
|
9 |
+
}
|
10 |
+
|
11 |
+
jQuery.post(ajaxurl, data , function(response) {
|
12 |
+
jQuery("#post-translations").html(response);
|
13 |
+
});
|
14 |
+
})
|
15 |
+
|
16 |
+
// ajax for term edit
|
17 |
+
jQuery('#term_lang_choice').change( function() {
|
18 |
+
var data = {
|
19 |
+
action: 'term_lang_choice',
|
20 |
+
lang: jQuery(this).attr('value'),
|
21 |
+
term_id: jQuery("input[name='tag_ID']").attr('value'),
|
22 |
+
taxonomy: jQuery("input[name='taxonomy']").attr('value')
|
23 |
+
}
|
24 |
+
|
25 |
+
jQuery.post(ajaxurl, data, function(response) {
|
26 |
+
jQuery("#term-translations").html(response);
|
27 |
+
});
|
28 |
+
})
|
29 |
+
|
30 |
+
});
|
admin.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
require_once(
|
|
|
4 |
|
5 |
class Polylang_Admin extends Polylang_Base {
|
6 |
function __construct() {
|
@@ -11,6 +12,9 @@ class Polylang_Admin extends Polylang_Base {
|
|
11 |
// adds the link to the languages panel in the wordpress admin menu
|
12 |
add_action('admin_menu', array(&$this, 'add_menus'));
|
13 |
|
|
|
|
|
|
|
14 |
// add the language column (as well as a filter by language) in 'All Posts' an 'All Pages' panels
|
15 |
add_filter('manage_posts_columns', array(&$this, 'add_post_column'), 10, 2);
|
16 |
add_filter('manage_pages_columns', array(&$this, 'add_post_column'));
|
@@ -22,6 +26,9 @@ class Polylang_Admin extends Polylang_Base {
|
|
22 |
// adds the Languages box in the 'Edit Post' and 'Edit Page' panels
|
23 |
add_action('add_meta_boxes', array(&$this, 'add_meta_boxes'));
|
24 |
|
|
|
|
|
|
|
25 |
// adds actions related to languages when saving aor deleting posts and pages
|
26 |
add_action('save_post', array(&$this, 'save_post'));
|
27 |
add_action('before_delete_post', array(&$this, 'delete_post'));
|
@@ -34,6 +41,9 @@ class Polylang_Admin extends Polylang_Base {
|
|
34 |
add_action('category_edit_form_fields', array(&$this, 'edit_term_form'));
|
35 |
add_action('post_tag_edit_form_fields', array(&$this, 'edit_term_form'));
|
36 |
|
|
|
|
|
|
|
37 |
// adds the language column in the 'Categories' and 'Post Tags' tables
|
38 |
add_filter('manage_edit-category_columns', array(&$this, 'add_term_column'));
|
39 |
add_filter('manage_edit-post_tag_columns', array(&$this, 'add_term_column'));
|
@@ -41,15 +51,18 @@ class Polylang_Admin extends Polylang_Base {
|
|
41 |
add_action('manage_post_tag_custom_column', array(&$this, 'term_column'), 10, 3);
|
42 |
|
43 |
// adds actions related to languages when saving or deleting categories and post tags
|
44 |
-
add_action('created_category', array(&$this,'save_term'));
|
45 |
-
add_action('created_post_tag', array(&$this,'save_term'));
|
46 |
-
add_action('edited_category', array(&$this,'save_term'));
|
47 |
-
add_action('edited_post_tag', array(&$this,'save_term'));
|
48 |
-
add_action('delete_category', array(&$this,'delete_term'));
|
49 |
-
add_action('delete_post_tag', array(&$this,'delete_term'));
|
|
|
|
|
|
|
50 |
|
51 |
// refresh rewrite rules if the 'page_on_front' option is modified
|
52 |
-
add_action('update_option', array(&$this,'update_option'));
|
53 |
}
|
54 |
|
55 |
// adds a 'settings' link in the plugins table
|
@@ -64,6 +77,11 @@ class Polylang_Admin extends Polylang_Base {
|
|
64 |
add_submenu_page('options-general.php', __('Languages','polylang'), __('Languages','polylang'), 'manage_options', 'mlang', array($this, 'languages_page'));
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
// the languages panel
|
68 |
function languages_page() {
|
69 |
global $wp_rewrite;
|
@@ -72,6 +90,11 @@ class Polylang_Admin extends Polylang_Base {
|
|
72 |
$listlanguages = $this->get_languages_list();
|
73 |
$list_table = new Polylang_List_Table();
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
$action = '';
|
76 |
if (isset($_REQUEST['action']))
|
77 |
$action = $_REQUEST['action'];
|
@@ -186,6 +209,12 @@ class Polylang_Admin extends Polylang_Base {
|
|
186 |
exit;
|
187 |
break;
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
case 'options':
|
190 |
check_admin_referer( 'options-lang', '_wpnonce_options-lang' );
|
191 |
|
@@ -210,7 +239,7 @@ class Polylang_Admin extends Polylang_Base {
|
|
210 |
$list_table->prepare_items($data);
|
211 |
|
212 |
// displays the page
|
213 |
-
include(
|
214 |
}
|
215 |
|
216 |
// adds the language column (before the date column) in the posts and pages list table
|
@@ -251,11 +280,11 @@ class Polylang_Admin extends Polylang_Base {
|
|
251 |
|
252 |
// adds a filter for languages in the Posts and Pages panels
|
253 |
function restrict_manage_posts() {
|
254 |
-
global $typenow;
|
255 |
global $wp_query;
|
|
|
256 |
$languages = $this->get_languages_list();
|
257 |
|
258 |
-
if (!empty($languages) &&
|
259 |
$qvars = $wp_query->query;
|
260 |
wp_dropdown_categories(array(
|
261 |
'show_option_all' => __('Show all languages', 'polylang'),
|
@@ -267,8 +296,8 @@ class Polylang_Admin extends Polylang_Base {
|
|
267 |
|
268 |
// adds the Languages box in the 'Edit Post' and 'Edit Page' panels
|
269 |
function add_meta_boxes() {
|
270 |
-
add_meta_box('ml_box', __('Languages','
|
271 |
-
add_meta_box('ml_box', __('Languages','
|
272 |
}
|
273 |
|
274 |
// the Languages metabox in the 'Edit Post' and 'Edit Page' panels
|
@@ -279,30 +308,52 @@ class Polylang_Admin extends Polylang_Base {
|
|
279 |
$lang = $this->get_post_language($post_ID);
|
280 |
if (isset($_GET['new_lang']))
|
281 |
$lang = $this->get_language($_GET['new_lang']);
|
|
|
|
|
282 |
|
283 |
-
include(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
}
|
285 |
|
286 |
// called when a post (or page) is saved, published or updated
|
287 |
// the underscore in '_lang' hides the post meta in the Custom Fields metabox in the Edit Post screen
|
288 |
function save_post($post_id) {
|
|
|
289 |
$id = wp_is_post_revision($post_id);
|
290 |
if ($id)
|
291 |
$post_id = $id;
|
292 |
|
293 |
-
if (isset($_POST['
|
294 |
-
|
295 |
|
296 |
$lang = $this->get_post_language($post_id);
|
297 |
$listlanguages = $this->get_languages_list();
|
|
|
298 |
foreach ($listlanguages as $language) {
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
303 |
}
|
304 |
-
|
305 |
-
|
|
|
|
|
|
|
306 |
}
|
307 |
}
|
308 |
|
@@ -334,25 +385,40 @@ class Polylang_Admin extends Polylang_Base {
|
|
334 |
|
335 |
// adds the language field in the 'Categories' and 'Post Tags' panels
|
336 |
function add_term_form() {
|
337 |
-
$
|
|
|
338 |
if (isset($_GET['new_lang']))
|
339 |
$lang = $this->get_language($_GET['new_lang']);
|
340 |
|
341 |
$listlanguages = $this->get_languages_list();
|
342 |
|
343 |
// displays the language field
|
344 |
-
include(
|
345 |
}
|
346 |
|
347 |
// adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels
|
348 |
function edit_term_form($tag) {
|
349 |
$term_id = $tag->term_id;
|
350 |
$lang = $this->get_term_language($term_id);
|
351 |
-
|
352 |
-
$listlanguages = $this->get_languages_list();
|
353 |
$taxonomy = $tag->taxonomy;
|
|
|
|
|
|
|
|
|
354 |
|
355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
}
|
357 |
|
358 |
// adds the language column (before the posts column) in the 'Categories' or Post Tags table
|
@@ -377,36 +443,44 @@ class Polylang_Admin extends Polylang_Base {
|
|
377 |
|
378 |
// called when a category or post tag is created or edited
|
379 |
function save_term($term_id) {
|
380 |
-
if (isset($_POST['lang_choice']) && $_POST['lang_choice'] != -1 ) {
|
381 |
-
update_metadata('term', $term_id, '_language', $_POST['lang_choice'] );
|
382 |
-
$lang = $this->get_language($_POST['lang_choice']);
|
383 |
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
389 |
update_metadata('term', $_POST[$slug], '_lang-'.$lang->slug, $term_id );
|
390 |
-
}
|
391 |
}
|
392 |
-
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
-
$qvars = $this->get_referer_vars();
|
395 |
-
if (isset($qvars['from_tag']) && isset($qvars['from_lang']) && isset($qvars['new_lang'])) {
|
396 |
-
$from_lang = $this->get_language($qvars['from_lang']);
|
397 |
-
update_metadata('term', $term_id, '_lang-'.$from_lang->slug, $qvars['from_tag'] );
|
398 |
-
$new_lang = $this->get_language($qvars['new_lang']);
|
399 |
-
update_metadata('term', $qvars['from_tag'], '_lang-'.$new_lang->slug, $term_id );
|
400 |
}
|
401 |
|
402 |
// propagates translations between them
|
403 |
-
|
404 |
-
foreach ($listlanguages as $
|
405 |
-
|
406 |
-
|
407 |
-
|
|
|
|
|
408 |
}
|
409 |
}
|
|
|
410 |
}
|
411 |
|
412 |
// called when a category or post tag is deleted
|
@@ -439,6 +513,24 @@ class Polylang_Admin extends Polylang_Base {
|
|
439 |
return $new_terms;
|
440 |
}
|
441 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
// refresh rewrite rules if the 'page_on_front' option is modified
|
443 |
function update_option($option) {
|
444 |
global $wp_rewrite;
|
1 |
<?php
|
2 |
|
3 |
+
require_once(POLYLANG_DIR.'/list-table.php');
|
4 |
+
define('POLYLANG_URL', WP_PLUGIN_URL .'/polylang');
|
5 |
|
6 |
class Polylang_Admin extends Polylang_Base {
|
7 |
function __construct() {
|
12 |
// adds the link to the languages panel in the wordpress admin menu
|
13 |
add_action('admin_menu', array(&$this, 'add_menus'));
|
14 |
|
15 |
+
// setup js scripts
|
16 |
+
add_action('admin_print_scripts', array($this,'admin_js'));
|
17 |
+
|
18 |
// add the language column (as well as a filter by language) in 'All Posts' an 'All Pages' panels
|
19 |
add_filter('manage_posts_columns', array(&$this, 'add_post_column'), 10, 2);
|
20 |
add_filter('manage_pages_columns', array(&$this, 'add_post_column'));
|
26 |
// adds the Languages box in the 'Edit Post' and 'Edit Page' panels
|
27 |
add_action('add_meta_boxes', array(&$this, 'add_meta_boxes'));
|
28 |
|
29 |
+
// ajax response for post metabox
|
30 |
+
add_action('wp_ajax_post_lang_choice', array($this,'post_lang_choice'));
|
31 |
+
|
32 |
// adds actions related to languages when saving aor deleting posts and pages
|
33 |
add_action('save_post', array(&$this, 'save_post'));
|
34 |
add_action('before_delete_post', array(&$this, 'delete_post'));
|
41 |
add_action('category_edit_form_fields', array(&$this, 'edit_term_form'));
|
42 |
add_action('post_tag_edit_form_fields', array(&$this, 'edit_term_form'));
|
43 |
|
44 |
+
// ajax response for edit term form
|
45 |
+
add_action('wp_ajax_term_lang_choice', array($this,'term_lang_choice'));
|
46 |
+
|
47 |
// adds the language column in the 'Categories' and 'Post Tags' tables
|
48 |
add_filter('manage_edit-category_columns', array(&$this, 'add_term_column'));
|
49 |
add_filter('manage_edit-post_tag_columns', array(&$this, 'add_term_column'));
|
51 |
add_action('manage_post_tag_custom_column', array(&$this, 'term_column'), 10, 3);
|
52 |
|
53 |
// adds actions related to languages when saving or deleting categories and post tags
|
54 |
+
add_action('created_category', array(&$this, 'save_term'));
|
55 |
+
add_action('created_post_tag', array(&$this, 'save_term'));
|
56 |
+
add_action('edited_category', array(&$this, 'save_term'));
|
57 |
+
add_action('edited_post_tag', array(&$this, 'save_term'));
|
58 |
+
add_action('delete_category', array(&$this, 'delete_term'));
|
59 |
+
add_action('delete_post_tag', array(&$this, 'delete_term'));
|
60 |
+
|
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
|
77 |
add_submenu_page('options-general.php', __('Languages','polylang'), __('Languages','polylang'), 'manage_options', 'mlang', array($this, 'languages_page'));
|
78 |
}
|
79 |
|
80 |
+
// setup js scripts
|
81 |
+
function admin_js() {
|
82 |
+
wp_enqueue_script('polylang_admin', POLYLANG_URL.'/admin.js');
|
83 |
+
}
|
84 |
+
|
85 |
// the languages panel
|
86 |
function languages_page() {
|
87 |
global $wp_rewrite;
|
90 |
$listlanguages = $this->get_languages_list();
|
91 |
$list_table = new Polylang_List_Table();
|
92 |
|
93 |
+
// for nav menus form
|
94 |
+
$locations = get_registered_nav_menus();
|
95 |
+
$menus = wp_get_nav_menus();
|
96 |
+
$menu_lang = get_option('polylang_nav_menus');
|
97 |
+
|
98 |
$action = '';
|
99 |
if (isset($_REQUEST['action']))
|
100 |
$action = $_REQUEST['action'];
|
209 |
exit;
|
210 |
break;
|
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;
|
217 |
+
|
218 |
case 'options':
|
219 |
check_admin_referer( 'options-lang', '_wpnonce_options-lang' );
|
220 |
|
239 |
$list_table->prepare_items($data);
|
240 |
|
241 |
// displays the page
|
242 |
+
include(POLYLANG_DIR.'/languages-form.php');
|
243 |
}
|
244 |
|
245 |
// adds the language column (before the date column) in the posts and pages list table
|
280 |
|
281 |
// adds a filter for languages in the Posts and Pages panels
|
282 |
function restrict_manage_posts() {
|
|
|
283 |
global $wp_query;
|
284 |
+
$screen = get_current_screen();
|
285 |
$languages = $this->get_languages_list();
|
286 |
|
287 |
+
if (!empty($languages) && $screen->base == 'edit') {
|
288 |
$qvars = $wp_query->query;
|
289 |
wp_dropdown_categories(array(
|
290 |
'show_option_all' => __('Show all languages', 'polylang'),
|
296 |
|
297 |
// adds the Languages box in the 'Edit Post' and 'Edit Page' panels
|
298 |
function add_meta_boxes() {
|
299 |
+
add_meta_box('ml_box', __('Languages','polylang'), array(&$this,'post_language'), 'post', 'side','high');
|
300 |
+
add_meta_box('ml_box', __('Languages','polylang'), array(&$this,'post_language'), 'page', 'side','high');
|
301 |
}
|
302 |
|
303 |
// the Languages metabox in the 'Edit Post' and 'Edit Page' panels
|
308 |
$lang = $this->get_post_language($post_ID);
|
309 |
if (isset($_GET['new_lang']))
|
310 |
$lang = $this->get_language($_GET['new_lang']);
|
311 |
+
|
312 |
+
$listlanguages = $this->get_languages_list();
|
313 |
|
314 |
+
include(POLYLANG_DIR.'/post-metabox.php');
|
315 |
+
}
|
316 |
+
|
317 |
+
// ajax response for post metabox
|
318 |
+
function post_lang_choice() {
|
319 |
+
$listlanguages = $this->get_languages_list();
|
320 |
+
|
321 |
+
$lang = $this->get_language($_POST['lang']);
|
322 |
+
$post_ID = $_POST['post_id'];
|
323 |
+
|
324 |
+
if ($lang)
|
325 |
+
include(POLYLANG_DIR.'/post-translations.php');
|
326 |
+
|
327 |
+
die();
|
328 |
}
|
329 |
|
330 |
// called when a post (or page) is saved, published or updated
|
331 |
// the underscore in '_lang' hides the post meta in the Custom Fields metabox in the Edit Post screen
|
332 |
function save_post($post_id) {
|
333 |
+
|
334 |
$id = wp_is_post_revision($post_id);
|
335 |
if ($id)
|
336 |
$post_id = $id;
|
337 |
|
338 |
+
if (isset($_POST['post_lang_choice']))
|
339 |
+
wp_set_post_terms($post_id, $_POST['post_lang_choice'], 'language' );
|
340 |
|
341 |
$lang = $this->get_post_language($post_id);
|
342 |
$listlanguages = $this->get_languages_list();
|
343 |
+
|
344 |
foreach ($listlanguages as $language) {
|
345 |
+
|
346 |
+
if (isset($_POST[$language->slug]) && $_POST[$language->slug]) {
|
347 |
+
// FIXME I don't check that the translated post is in the right language !
|
348 |
+
update_post_meta($post_id, '_lang-'.$language->slug, $_POST[$language->slug]); // saves the links to translated posts
|
349 |
+
if ($lang)
|
350 |
+
update_post_meta($this->get_translated_post($post_id, $language), '_lang-'.$lang->slug, $post_id); // tells the translated to link to this post
|
351 |
}
|
352 |
+
else {
|
353 |
+
// deletes the translation in case there was previously one
|
354 |
+
if ($lang)
|
355 |
+
delete_post_meta($this->get_translated_post($post_id, $language), '_lang-'.$lang->slug); // in the translated post
|
356 |
+
delete_post_meta($post_id, '_lang-'.$language->slug); // in this post
|
357 |
}
|
358 |
}
|
359 |
|
385 |
|
386 |
// adds the language field in the 'Categories' and 'Post Tags' panels
|
387 |
function add_term_form() {
|
388 |
+
$taxonomy = $_GET['taxonomy'];
|
389 |
+
$lang = null;
|
390 |
if (isset($_GET['new_lang']))
|
391 |
$lang = $this->get_language($_GET['new_lang']);
|
392 |
|
393 |
$listlanguages = $this->get_languages_list();
|
394 |
|
395 |
// displays the language field
|
396 |
+
include(POLYLANG_DIR.'/add-term-form.php');
|
397 |
}
|
398 |
|
399 |
// adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels
|
400 |
function edit_term_form($tag) {
|
401 |
$term_id = $tag->term_id;
|
402 |
$lang = $this->get_term_language($term_id);
|
|
|
|
|
403 |
$taxonomy = $tag->taxonomy;
|
404 |
+
$listlanguages = $this->get_languages_list();
|
405 |
+
|
406 |
+
include(POLYLANG_DIR.'/edit-term-form.php');
|
407 |
+
}
|
408 |
|
409 |
+
// ajax response for edit term form
|
410 |
+
function term_lang_choice()
|
411 |
+
{
|
412 |
+
if ($_POST['lang']) {
|
413 |
+
$lang = $this->get_language($_POST['lang']);
|
414 |
+
$term_id = isset($_POST['term_id']) ? $_POST['term_id'] : null;
|
415 |
+
$taxonomy = $_POST['taxonomy'];
|
416 |
+
|
417 |
+
$listlanguages = $this->get_languages_list();
|
418 |
+
|
419 |
+
include(POLYLANG_DIR.'/term-translations.php');
|
420 |
+
}
|
421 |
+
die();
|
422 |
}
|
423 |
|
424 |
// adds the language column (before the posts column) in the 'Categories' or Post Tags table
|
443 |
|
444 |
// called when a category or post tag is created or edited
|
445 |
function save_term($term_id) {
|
|
|
|
|
|
|
446 |
|
447 |
+
if (isset($_POST['term_lang_choice']) && $_POST['term_lang_choice'])
|
448 |
+
update_metadata('term', $term_id, '_language', $_POST['term_lang_choice'] );
|
449 |
+
else
|
450 |
+
delete_metadata('term', $term_id, '_language');
|
451 |
+
|
452 |
+
|
453 |
+
$lang = $this->get_term_language($term_id);
|
454 |
+
$listlanguages = $this->get_languages_list();
|
455 |
+
|
456 |
+
foreach ($listlanguages as $language) {
|
457 |
+
$slug = '_lang-'.$language->slug;
|
458 |
+
if (isset($_POST[$slug]) && $_POST[$slug]) {
|
459 |
+
// FIXME I don't check that the translated term is in the right language !
|
460 |
+
update_metadata('term', $term_id, $slug, $_POST[$slug] );
|
461 |
+
if ($lang)
|
462 |
update_metadata('term', $_POST[$slug], '_lang-'.$lang->slug, $term_id );
|
|
|
463 |
}
|
464 |
+
else {
|
465 |
+
// deletes the translation in case there was previously one
|
466 |
+
if ($lang)
|
467 |
+
delete_metadata('term', $this->get_translated_term($term_id, $language), '_lang-'.$lang->slug); // in the translated term
|
468 |
+
delete_metadata('term', $term_id, '_lang-'.$language->slug); // in this term
|
469 |
+
}
|
470 |
|
|
|
|
|
|
|
|
|
|
|
|
|
471 |
}
|
472 |
|
473 |
// propagates translations between them
|
474 |
+
if (isset($lang)) {
|
475 |
+
foreach ($listlanguages as $language) {
|
476 |
+
foreach ($listlanguages as $lg) {
|
477 |
+
$id = $this->get_translated_term($term_id, $lg);
|
478 |
+
if ($lg != $lang && $lg != $language && $id)
|
479 |
+
update_metadata('term',$this->get_translated_term($term_id, $language), '_lang-'.$lg->slug, $id);
|
480 |
+
}
|
481 |
}
|
482 |
}
|
483 |
+
|
484 |
}
|
485 |
|
486 |
// called when a category or post tag is deleted
|
513 |
return $new_terms;
|
514 |
}
|
515 |
|
516 |
+
// modifies the theme location nav menu metabox
|
517 |
+
function nav_menu_theme_locations() {
|
518 |
+
// only if the theme supports nav menus
|
519 |
+
if ( ! current_theme_supports( 'menus' ) )
|
520 |
+
return;
|
521 |
+
|
522 |
+
// thanks to : http://wordpress.stackexchange.com/questions/2770/how-to-add-a-custom-metabox-to-the-menu-management-admin-screen
|
523 |
+
$metabox = &$GLOBALS['wp_meta_boxes']['nav-menus']['side']['default']['nav-menu-theme-locations'];
|
524 |
+
$metabox['callback'] = array(&$this,'nav_menu_language');
|
525 |
+
$metabox['title'] = __('Theme locations and languages', 'polylang');
|
526 |
+
}
|
527 |
+
|
528 |
+
// displays a message to redirect to the languages options page
|
529 |
+
function nav_menu_language() {
|
530 |
+
echo '<p class="howto">' . sprintf (__('Please go to the %slanguages page%s to set theme locations and languages', 'polylang'),
|
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;
|
base.php
CHANGED
@@ -21,19 +21,19 @@ class Polylang_Base {
|
|
21 |
}
|
22 |
|
23 |
// returns the language by its id or its slug
|
|
|
24 |
function get_language($value) {
|
25 |
if (is_numeric($value))
|
26 |
-
$
|
27 |
elseif (is_string($value))
|
28 |
-
$
|
29 |
-
|
30 |
-
return get_term_by($field, $value , 'language');
|
31 |
}
|
32 |
|
33 |
// returns the language of a post
|
34 |
function get_post_language($post_id) {
|
35 |
$lang = get_the_terms($post_id, 'language' );
|
36 |
-
return ($lang) ? reset($lang) :
|
37 |
}
|
38 |
|
39 |
// returns the id of the translation of a post
|
@@ -49,8 +49,7 @@ class Polylang_Base {
|
|
49 |
|
50 |
// returns the language of a term
|
51 |
function get_term_language($term_id) {
|
52 |
-
$
|
53 |
-
return $this->get_language($value);
|
54 |
}
|
55 |
|
56 |
// returns the id of the translation of a term (category or post_tag)
|
21 |
}
|
22 |
|
23 |
// returns the language by its id or its slug
|
24 |
+
// Note ist seems that the first option is better for performance (3.2.1)
|
25 |
function get_language($value) {
|
26 |
if (is_numeric($value))
|
27 |
+
return get_term($value, 'language');
|
28 |
elseif (is_string($value))
|
29 |
+
return get_term_by('slug', $value , 'language');
|
30 |
+
return null;
|
|
|
31 |
}
|
32 |
|
33 |
// returns the language of a post
|
34 |
function get_post_language($post_id) {
|
35 |
$lang = get_the_terms($post_id, 'language' );
|
36 |
+
return ($lang) ? reset($lang) : null; // there's only one language per post : first element of the array returned
|
37 |
}
|
38 |
|
39 |
// returns the id of the translation of a post
|
49 |
|
50 |
// returns the language of a term
|
51 |
function get_term_language($term_id) {
|
52 |
+
return $this->get_language(get_metadata('term', $term_id, '_language', true));
|
|
|
53 |
}
|
54 |
|
55 |
// returns the id of the translation of a term (category or post_tag)
|
edit-term-form.php
CHANGED
@@ -1,74 +1,20 @@
|
|
1 |
<?php
|
2 |
// adds languages related fields in Edit Category and Edit Tag admin panels
|
3 |
// unfortunately can't reuse add-term-for.php as WordPress uses here a table instead of div :(
|
4 |
-
|
5 |
-
// displays the language select list
|
6 |
?>
|
7 |
<tr class="form-field">
|
8 |
-
<th scope="row" valign="top"><label for="
|
9 |
-
<td><select name="
|
10 |
-
<option value="
|
11 |
foreach ($listlanguages as $language) {
|
12 |
-
printf("<option value='%s'
|
13 |
} ?>
|
14 |
</select><br />
|
15 |
<span class="description"><?php _e('Sets the language', 'polylang');?></span></td>
|
16 |
</tr>
|
17 |
|
18 |
-
|
19 |
-
//
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
if ($lang) { // do not display translation fields if term language is not set ?>
|
24 |
-
<tr class="form-field">
|
25 |
-
<th scope="row" valign="top"><?php _e('Translations', 'polylang');?></th>
|
26 |
-
<td><table>
|
27 |
-
<thead><tr>
|
28 |
-
<th style="padding: 0px; font-weight: bold"><?php _e('Language', 'polylang');?></th>
|
29 |
-
<th style="padding: 0px; font-weight: bold"><?php _e('Translation', 'polylang');?></th>
|
30 |
-
<th style="padding: 0px; font-weight: bold"><?php _e('Edit', 'polylang');?></th>
|
31 |
-
</tr></thead>
|
32 |
-
<tbody>
|
33 |
-
<?php foreach ($listlanguages as $language) {
|
34 |
-
if ($language != $lang) {
|
35 |
-
$value = $this->get_translated_term($term_id, $language);?>
|
36 |
-
<tr><td style="padding: 0px"><?php echo $language->name;?></td>
|
37 |
-
<?php if (!$value) {
|
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;?>">
|
42 |
-
<option value="-1"></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
|
48 |
-
}
|
49 |
-
else { ?>
|
50 |
-
<td style="padding: 0px">
|
51 |
-
</td> <?php
|
52 |
-
} ?>
|
53 |
-
<td style="padding: 0px">
|
54 |
-
<?php printf('<a href="edit-tags.php?taxonomy=%s&from_tag=%s&from_lang=%s&new_lang=%s">%s</a>',
|
55 |
-
$taxonomy, $term_id, $lang->slug, $language->slug, __('Add new','polylang')) ?>
|
56 |
-
</td> <?php
|
57 |
-
}
|
58 |
-
else { ?>
|
59 |
-
<td style="padding: 0px"><?php
|
60 |
-
$translation_id = $this->get_translated_term($term_id, $language);
|
61 |
-
$translation = get_term_by('id', $translation_id, $taxonomy);
|
62 |
-
echo $translation->name; ?>
|
63 |
-
</td>
|
64 |
-
<td style="padding: 0px">
|
65 |
-
<?php printf('<a href="edit-tags.php?action=edit&taxonomy=%S&tag_ID=%s">%s</a>', $taxonomy, $value, __('Edit','polylang')) ?>
|
66 |
-
</td> <?php
|
67 |
-
} ?>
|
68 |
-
</tr><?php
|
69 |
-
} // if (!$value)
|
70 |
-
} // foreach ?>
|
71 |
-
</tbody>
|
72 |
-
</table></td>
|
73 |
-
</tr> <?php
|
74 |
-
} // if ($lang) ?>
|
1 |
<?php
|
2 |
// adds languages related fields in Edit Category and Edit Tag admin panels
|
3 |
// unfortunately can't reuse add-term-for.php as WordPress uses here a table instead of div :(
|
|
|
|
|
4 |
?>
|
5 |
<tr class="form-field">
|
6 |
+
<th scope="row" valign="top"><label for="term_lang_choice"><?php _e('Language', 'polylang');?></label></th>
|
7 |
+
<td><select name="term_lang_choice" id="term_lang_choice">
|
8 |
+
<option value="0"></option><?php
|
9 |
foreach ($listlanguages as $language) {
|
10 |
+
printf("<option value='%s'%s>%s</option>\n", $language->term_id, $language == $lang ? ' selected="selected"' : '', $language->name);
|
11 |
} ?>
|
12 |
</select><br />
|
13 |
<span class="description"><?php _e('Sets the language', 'polylang');?></span></td>
|
14 |
</tr>
|
15 |
|
16 |
+
<tr id="term-translations" class="form-field"><?php
|
17 |
+
// do not display translation fields if term language is not set
|
18 |
+
if ($lang)
|
19 |
+
include(POLYLANG_DIR.'/term-translations.php');?>
|
20 |
+
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
languages-form.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php // displays the Languages admin panel
|
2 |
|
3 |
// I don't use the custom taxonomy form provide by Wordpress because I want to modify the labels below the fields...
|
4 |
-
//
|
5 |
|
6 |
// The term fields are used as follows :
|
7 |
// name -> language name (used only for display)
|
@@ -69,9 +69,54 @@ else
|
|
69 |
</div> <!-- form-wrap -->
|
70 |
</div> <!-- col-wrap -->
|
71 |
</div> <!-- col-left -->
|
72 |
-
</div> <!-- col-container -->
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
//FIXME one inline CSS ?>
|
76 |
<div class="form-wrap">
|
77 |
<h3><?php _e('Options','polylang');?></h3>
|
@@ -101,7 +146,7 @@ else
|
|
101 |
<label><?php _e('otherwise: ', 'polylang');?><select name="default_lang" id="default_lang">
|
102 |
<?php $listlanguages = $this->get_languages_list();
|
103 |
foreach ($listlanguages as $language) {
|
104 |
-
printf("<option value
|
105 |
} ?>
|
106 |
</select></label>
|
107 |
</td>
|
1 |
<?php // displays the Languages admin panel
|
2 |
|
3 |
// I don't use the custom taxonomy form provide by Wordpress because I want to modify the labels below the fields...
|
4 |
+
// It seems that there is currently (3.2.1) no filter to do this
|
5 |
|
6 |
// The term fields are used as follows :
|
7 |
// name -> language name (used only for display)
|
69 |
</div> <!-- form-wrap -->
|
70 |
</div> <!-- col-wrap -->
|
71 |
</div> <!-- col-left -->
|
72 |
+
</div> <!-- col-container --> <?php
|
73 |
|
74 |
+
// displays the nav menus languages form
|
75 |
+
if (current_theme_supports( 'menus' )) { ?>
|
76 |
+
|
77 |
+
<div class="form-wrap">
|
78 |
+
<h3 id="menus"><?php _e('Menus','polylang');?></h3>
|
79 |
+
|
80 |
+
<form id="nav-menus-lang" method="post" action="admin.php?page=mlang" class="validate">
|
81 |
+
<?php wp_nonce_field('nav-menus-lang', '_wpnonce_nav-menus-lang');?>
|
82 |
+
<input type="hidden" name="action" value="nav-menus" />
|
83 |
+
|
84 |
+
<table class="wp-list-table widefat fixed tags" cellspacing="0" style="width: auto">
|
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 printf('<select name="menu-lang[%s][%s]" id="menu-lang-%s-%s">', $location, $language->slug, $location, $language->slug); ?>
|
97 |
+
<option value="0"></option>
|
98 |
+
<?php foreach ( $menus as $menu ) {
|
99 |
+
printf("<option value='%s'%s>%s</option>\n",
|
100 |
+
$menu->term_id,
|
101 |
+
$menu_lang[$location][$language->slug] == $menu->term_id ? ' selected="selected"' : '',
|
102 |
+
$menu->name);
|
103 |
+
} ?>
|
104 |
+
</select></td><?php
|
105 |
+
}?>
|
106 |
+
</tr><?php
|
107 |
+
}?>
|
108 |
+
</tbody>
|
109 |
+
|
110 |
+
</table>
|
111 |
+
|
112 |
+
<?php submit_button(); // since WP 3.1 ?>
|
113 |
+
|
114 |
+
</form>
|
115 |
+
</div> <!-- form-wrap --> <?php
|
116 |
+
|
117 |
+
} // if (current_theme_supports( 'menus' ))
|
118 |
+
|
119 |
+
// displays the Polylang options form
|
120 |
//FIXME one inline CSS ?>
|
121 |
<div class="form-wrap">
|
122 |
<h3><?php _e('Options','polylang');?></h3>
|
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("<option value='%s'%s>%s</option>\n", $language->slug, $options['default_lang'] == $language->slug ? ' selected="selected"' : '', $language->name);
|
150 |
} ?>
|
151 |
</select></label>
|
152 |
</td>
|
polylang-de_DE.mo
ADDED
Binary file
|
polylang-de_DE.po
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: polylang\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-04 12:09+0100\n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: F. Demarle\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"Language: \n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"Plural-Forms: nplurals=2: nplural=n>1\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-KeywordsList: _e;__;_c\n"
|
16 |
+
"X-Poedit-Basepath: .\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:255
|
21 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:422
|
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
|
25 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:5
|
26 |
+
msgid "Language"
|
27 |
+
msgstr "Sprache"
|
28 |
+
|
29 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:13
|
30 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:10
|
31 |
+
msgid "Sets the language"
|
32 |
+
msgstr "definiert die Sprache"
|
33 |
+
|
34 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/widget.php:5
|
35 |
+
msgid "Displays a language switcher"
|
36 |
+
msgstr "Zeige die Sprachenliste"
|
37 |
+
|
38 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/widget.php:6
|
39 |
+
msgid "Language Switcher"
|
40 |
+
msgstr "Sprachenliste"
|
41 |
+
|
42 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:70
|
43 |
+
msgid "Settings"
|
44 |
+
msgstr "Einstellungen"
|
45 |
+
|
46 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:77
|
47 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:300
|
48 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:301
|
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:291
|
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:514
|
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:519
|
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 :"
|
70 |
+
|
71 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
72 |
+
msgid "Post's language:"
|
73 |
+
msgstr "Sprache für die Artikel :"
|
74 |
+
|
75 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:6
|
76 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:10
|
77 |
+
msgid "Translations"
|
78 |
+
msgstr "Übersetzungen"
|
79 |
+
|
80 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
81 |
+
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:52
|
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:42
|
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"
|
96 |
+
|
97 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:31
|
98 |
+
msgid "Delete"
|
99 |
+
msgstr "Löschen"
|
100 |
+
|
101 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:48
|
102 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:46
|
103 |
+
msgid "Full name"
|
104 |
+
msgstr "Name"
|
105 |
+
|
106 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:49
|
107 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:52
|
108 |
+
#, fuzzy
|
109 |
+
msgid "Locale"
|
110 |
+
msgstr "Locale"
|
111 |
+
|
112 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:50
|
113 |
+
msgid "Code"
|
114 |
+
msgstr "Code"
|
115 |
+
|
116 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:51
|
117 |
+
msgid "Posts"
|
118 |
+
msgstr "Artikel"
|
119 |
+
|
120 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:29
|
121 |
+
msgid "Edit language"
|
122 |
+
msgstr "Sprache bearbeiten"
|
123 |
+
|
124 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:29
|
125 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:66
|
126 |
+
msgid "Add new language"
|
127 |
+
msgstr "Neue Sprache hinzufügen"
|
128 |
+
|
129 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:48
|
130 |
+
msgid "The name is how it is displayed on your site (for example: English)."
|
131 |
+
msgstr "Dieser Name wird dann auf der Website angezeigt (beispielweise : Deutsch)"
|
132 |
+
|
133 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:54
|
134 |
+
msgid "Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language."
|
135 |
+
msgstr "Wordpress Locale für die Sprache (beispielweise : de_DE). Du musst die .mo Datei für diese Sprache installieren."
|
136 |
+
|
137 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:58
|
138 |
+
msgid "Language code"
|
139 |
+
msgstr "Sprache code"
|
140 |
+
|
141 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:60
|
142 |
+
msgid "2-letters ISO 639-1 language code (for example: en)"
|
143 |
+
msgstr "2 Buchstaben ISO 639-1 sprache code (beispielweise : de)"
|
144 |
+
|
145 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:64
|
146 |
+
msgid "Update"
|
147 |
+
msgstr "Aktualisieren"
|
148 |
+
|
149 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:76
|
150 |
+
msgid "Menus"
|
151 |
+
msgstr "Menüs"
|
152 |
+
|
153 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:84
|
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:118
|
158 |
+
msgid "Options"
|
159 |
+
msgstr "Einstellungen"
|
160 |
+
|
161 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:128
|
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:134
|
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:139
|
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:141
|
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:142
|
179 |
+
msgid "otherwise: "
|
180 |
+
msgstr "sonst :"
|
181 |
+
|
182 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:2
|
183 |
+
msgid "ID of posts in other languages:"
|
184 |
+
msgstr "ID für die Artikel in andere Sprache :"
|
185 |
+
|
186 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:6
|
187 |
+
msgid "Post ID"
|
188 |
+
msgstr "ID für die Artikel"
|
189 |
+
|
190 |
+
#~ msgid "Title:"
|
191 |
+
#~ msgstr "Titre :"
|
192 |
+
|
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-
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
@@ -16,42 +16,21 @@ msgstr ""
|
|
16 |
"X-Poedit-Basepath: .\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:
|
20 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/
|
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/
|
23 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/
|
24 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:2
|
25 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:12
|
|
|
26 |
msgid "Language"
|
27 |
msgstr "Langue"
|
28 |
|
29 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:
|
30 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:
|
31 |
msgid "Sets the language"
|
32 |
msgstr "Définit la langue"
|
33 |
|
34 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:17
|
35 |
-
msgid "Translations"
|
36 |
-
msgstr "Traductions"
|
37 |
-
|
38 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:21
|
39 |
-
msgid "Translation"
|
40 |
-
msgstr "Traduction"
|
41 |
-
|
42 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:22
|
43 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:67
|
44 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:21
|
45 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:51
|
46 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:30
|
47 |
-
msgid "Edit"
|
48 |
-
msgstr "Modifier"
|
49 |
-
|
50 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:52
|
51 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:42
|
52 |
-
msgid "Add new"
|
53 |
-
msgstr "Ajouter"
|
54 |
-
|
55 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/widget.php:5
|
56 |
msgid "Displays a language switcher"
|
57 |
msgstr "Affiche la liste des langues "
|
@@ -60,51 +39,75 @@ msgstr "Affiche la liste des langues "
|
|
60 |
msgid "Language Switcher"
|
61 |
msgstr "Liste des langues"
|
62 |
|
63 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
64 |
msgid "Settings"
|
65 |
msgstr "Réglages"
|
66 |
|
67 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
68 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
69 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
70 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:13
|
71 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
72 |
msgid "Languages"
|
73 |
msgstr "Langues"
|
74 |
|
75 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:
|
76 |
msgid "Show all languages"
|
77 |
msgstr "Afficher toutes les langues"
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
80 |
msgid "Page's language:"
|
81 |
msgstr "Langue de la page"
|
82 |
|
83 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:
|
84 |
msgid "Post's language:"
|
85 |
msgstr "Langue de l'article"
|
86 |
|
87 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/
|
88 |
-
|
89 |
-
|
|
|
90 |
|
91 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/
|
92 |
-
msgid "
|
93 |
-
msgstr "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:31
|
96 |
msgid "Delete"
|
97 |
msgstr "Supprimer"
|
98 |
|
99 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:48
|
100 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
101 |
msgid "Full name"
|
102 |
msgstr "Nom"
|
103 |
|
104 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:49
|
105 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
|
|
106 |
msgid "Locale"
|
107 |
-
msgstr ""
|
108 |
|
109 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:50
|
110 |
msgid "Code"
|
@@ -114,59 +117,75 @@ msgstr "Code"
|
|
114 |
msgid "Posts"
|
115 |
msgstr "Articles"
|
116 |
|
117 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
118 |
msgid "Edit language"
|
119 |
msgstr "Modifier la langue"
|
120 |
|
121 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
122 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
123 |
msgid "Add new language"
|
124 |
msgstr "Ajouter une nouvelle langue"
|
125 |
|
126 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
127 |
msgid "The name is how it is displayed on your site (for example: English)."
|
128 |
msgstr "Le nom est utilisé un peu partout sur le site (par exemple : Français)"
|
129 |
|
130 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
131 |
msgid "Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language."
|
132 |
msgstr "Code Wordpress pour la langue (par exemple : fr_FR). Vous aurez besoin d'installer les fichiers .mo correspondant"
|
133 |
|
134 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
135 |
msgid "Language code"
|
136 |
msgstr "Code de la langue"
|
137 |
|
138 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
139 |
msgid "2-letters ISO 639-1 language code (for example: en)"
|
140 |
msgstr "Code ISO 639-1 à 2 lettres (par exemple : fr)"
|
141 |
|
142 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
143 |
msgid "Update"
|
144 |
msgstr "Mettre à jour"
|
145 |
|
146 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
msgid "Options"
|
148 |
msgstr "Options"
|
149 |
|
150 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
151 |
msgid "Keep /language/ in pretty permalinks"
|
152 |
msgstr "Conserve /language/ dans les permaliens"
|
153 |
|
154 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
155 |
msgid "Remove /language/ in pretty permalinks"
|
156 |
msgstr "Supprime /language/ dans les permaliens"
|
157 |
|
158 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
159 |
msgid "The front page default language is : "
|
160 |
msgstr "La langue par défaut de la page d'accueil est :"
|
161 |
|
162 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
163 |
msgid "set by the browser preference"
|
164 |
msgstr "définie par les préférences du navigateur"
|
165 |
|
166 |
-
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:
|
167 |
msgid "otherwise: "
|
168 |
msgstr "sinon :"
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
#~ msgid "Title:"
|
171 |
#~ msgstr "Titre :"
|
172 |
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: polylang\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-04 11:49+0100\n"
|
6 |
"PO-Revision-Date: \n"
|
7 |
"Last-Translator: F. Demarle\n"
|
8 |
"Language-Team: \n"
|
16 |
"X-Poedit-Basepath: .\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:255
|
21 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:422
|
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
|
25 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:5
|
26 |
msgid "Language"
|
27 |
msgstr "Langue"
|
28 |
|
29 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:13
|
30 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:10
|
31 |
msgid "Sets the language"
|
32 |
msgstr "Définit la langue"
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/widget.php:5
|
35 |
msgid "Displays a language switcher"
|
36 |
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:70
|
43 |
msgid "Settings"
|
44 |
msgstr "Réglages"
|
45 |
|
46 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:77
|
47 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:300
|
48 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:301
|
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:291
|
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:514
|
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:519
|
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"
|
70 |
|
71 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
72 |
msgid "Post's language:"
|
73 |
msgstr "Langue de l'article"
|
74 |
|
75 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:6
|
76 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:10
|
77 |
+
msgid "Translations"
|
78 |
+
msgstr "Traductions"
|
79 |
|
80 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
81 |
+
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:52
|
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:42
|
93 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
94 |
+
msgid "Add new"
|
95 |
+
msgstr "Ajouter"
|
96 |
|
97 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:31
|
98 |
msgid "Delete"
|
99 |
msgstr "Supprimer"
|
100 |
|
101 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:48
|
102 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:46
|
103 |
msgid "Full name"
|
104 |
msgstr "Nom"
|
105 |
|
106 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:49
|
107 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:52
|
108 |
+
#, fuzzy
|
109 |
msgid "Locale"
|
110 |
+
msgstr "Locale"
|
111 |
|
112 |
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:50
|
113 |
msgid "Code"
|
117 |
msgid "Posts"
|
118 |
msgstr "Articles"
|
119 |
|
120 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:29
|
121 |
msgid "Edit language"
|
122 |
msgstr "Modifier la langue"
|
123 |
|
124 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:29
|
125 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:66
|
126 |
msgid "Add new language"
|
127 |
msgstr "Ajouter une nouvelle langue"
|
128 |
|
129 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:48
|
130 |
msgid "The name is how it is displayed on your site (for example: English)."
|
131 |
msgstr "Le nom est utilisé un peu partout sur le site (par exemple : Français)"
|
132 |
|
133 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:54
|
134 |
msgid "Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language."
|
135 |
msgstr "Code Wordpress pour la langue (par exemple : fr_FR). Vous aurez besoin d'installer les fichiers .mo correspondant"
|
136 |
|
137 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:58
|
138 |
msgid "Language code"
|
139 |
msgstr "Code de la langue"
|
140 |
|
141 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:60
|
142 |
msgid "2-letters ISO 639-1 language code (for example: en)"
|
143 |
msgstr "Code ISO 639-1 à 2 lettres (par exemple : fr)"
|
144 |
|
145 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:64
|
146 |
msgid "Update"
|
147 |
msgstr "Mettre à jour"
|
148 |
|
149 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:76
|
150 |
+
msgid "Menus"
|
151 |
+
msgstr "Menus"
|
152 |
+
|
153 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:84
|
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:118
|
158 |
msgid "Options"
|
159 |
msgstr "Options"
|
160 |
|
161 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:128
|
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:134
|
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:139
|
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:141
|
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:142
|
178 |
msgid "otherwise: "
|
179 |
msgstr "sinon :"
|
180 |
|
181 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:2
|
182 |
+
msgid "ID of posts in other languages:"
|
183 |
+
msgstr "ID des articles dans les autres langues"
|
184 |
+
|
185 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:6
|
186 |
+
msgid "Post ID"
|
187 |
+
msgstr "ID de l'article"
|
188 |
+
|
189 |
#~ msgid "Title:"
|
190 |
#~ msgstr "Titre :"
|
191 |
|
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,13 +23,15 @@ Description: Adds multilingual capability to Wordpress
|
|
23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
24 |
*/
|
25 |
|
26 |
-
define('
|
27 |
-
|
28 |
-
require_once(
|
29 |
-
require_once(
|
|
|
30 |
|
31 |
class Polylang extends Polylang_Base {
|
32 |
var $curlang;
|
|
|
33 |
var $list_textdomains = array();
|
34 |
var $search_form_filter = false;
|
35 |
|
@@ -40,61 +42,67 @@ class Polylang extends Polylang_Base {
|
|
40 |
register_deactivation_hook( __FILE__, array(&$this, 'deactivate') );
|
41 |
|
42 |
// plugin and widget initialization
|
43 |
-
add_action('init', array(&$this,'init'));
|
44 |
-
add_action('widgets_init', array(&$this,'widgets_init'));
|
45 |
|
46 |
// rewrite rules
|
47 |
-
add_filter('rewrite_rules_array', array(&$this,'rewrite_rules_array' ));
|
48 |
|
49 |
// filters categories and post tags by language
|
50 |
-
add_filter('
|
51 |
|
52 |
if (is_admin())
|
53 |
new Polylang_Admin();
|
54 |
else {
|
55 |
// text domain management
|
56 |
-
add_filter('locale', array(&$this,'get_locale'));
|
57 |
-
add_filter('override_load_textdomain', array(&$this,'mofile'), 10, 3);
|
58 |
-
add_action('wp', array(&$this,'load_textdomains'));
|
59 |
|
60 |
// filters posts according to the language
|
61 |
-
add_filter('pre_get_posts', array(&$this,'pre_get_posts'));
|
62 |
|
63 |
// meta in the html head section
|
64 |
remove_action('wp_head', 'rel_canonical');
|
65 |
-
add_action('wp_head', array(&$this,'wp_head'));
|
66 |
|
67 |
// prevents redirection of the homepage
|
68 |
-
add_filter('redirect_canonical', array(&$this,'redirect_canonical'), 10, 2);
|
69 |
|
70 |
// adds javascript at the end of the document
|
71 |
-
add_action('wp_print_footer_scripts', array(&$this,'wp_print_footer_scripts'));
|
72 |
|
73 |
// adds the language information in the search form
|
74 |
-
add_filter('get_search_form', array(&$this,'get_search_form'));
|
75 |
|
76 |
// filters the pages according to the current language
|
77 |
-
add_filter('get_pages', array(&$this,'get_pages'), 10, 2);
|
|
|
|
|
|
|
78 |
|
79 |
// rewrites feed links to filter them by language
|
80 |
-
add_filter('feed_link', array(&$this,'feed_link'), 10, 2);
|
81 |
|
82 |
// rewrites archives links to filter them by language
|
83 |
-
add_filter('getarchives_join', array(&$this,'posts_join'));
|
84 |
-
add_filter('getarchives_where', array(&$this,'posts_where'));
|
85 |
-
add_filter('get_archives_link', array(&$this,'get_archives_link'));
|
86 |
|
87 |
// rewrites next and previous post links to filter them by language
|
88 |
-
add_filter('get_previous_post_join', array(&$this,'posts_join'));
|
89 |
-
add_filter('get_next_post_join', array(&$this,'posts_join'));
|
90 |
-
add_filter('get_previous_post_where', array(&$this,'posts_where'));
|
91 |
-
add_filter('get_next_post_where', array(&$this,'posts_where'));
|
|
|
|
|
|
|
92 |
|
93 |
// allows a new value for the 'show' parameter to display the homepage url according to the current language
|
94 |
-
add_filter('bloginfo_url', array(&$this,'bloginfo_url'), 10, 2);
|
95 |
|
96 |
// Template tags
|
97 |
-
add_action('the_languages', array(&$this,'the_languages'));
|
98 |
}
|
99 |
}
|
100 |
|
@@ -124,7 +132,7 @@ class Polylang extends Polylang_Base {
|
|
124 |
) $charset_collate;");
|
125 |
|
126 |
// codex tells to use the init action to call register_taxonomy but I need it now for my rewrite rules
|
127 |
-
register_taxonomy('language', 'post', array('label' => false, 'query_var'=>'lang'));
|
128 |
|
129 |
// defines default values for options in case this is the first installation
|
130 |
$options = get_option('polylang');
|
@@ -132,7 +140,7 @@ class Polylang extends Polylang_Base {
|
|
132 |
$options['browser'] = 1; // default language for the front page is set by browser preference
|
133 |
$options['rewrite'] = 0; // do not remove /language/ in permalinks
|
134 |
}
|
135 |
-
$options['version'] =
|
136 |
update_option('polylang', $options);
|
137 |
|
138 |
// add our rewrite rules
|
@@ -168,6 +176,7 @@ class Polylang extends Polylang_Base {
|
|
168 |
$wp_rewrite->extra_permastructs['language'][0] = '%language%';
|
169 |
}
|
170 |
|
|
|
171 |
load_plugin_textdomain('polylang', false, dirname(plugin_basename( __FILE__ ))); // plugin i18n
|
172 |
}
|
173 |
|
@@ -225,40 +234,42 @@ class Polylang extends Polylang_Base {
|
|
225 |
return $newrules + $rules;
|
226 |
}
|
227 |
|
228 |
-
// filters categories and post tags by language when needed (both in admin panels and frontend
|
229 |
-
function
|
|
|
|
|
|
|
|
|
230 |
if (is_admin()) {
|
231 |
-
$screen = get_current_screen();
|
|
|
|
|
232 |
if (isset($screen))
|
233 |
// does nothing in the Categories, Post tags, Languages an Posts* admin panels
|
234 |
if ($screen->base == 'edit-tags' || $screen->base == 'toplevel_page_mlang' || $screen->base == 'edit')
|
235 |
-
return $
|
236 |
|
237 |
// *FIXME I want all categories in the dropdown list and only the ones in the right language in the inline edit
|
238 |
// It seems that I need javascript to get the post_id as inline edit data are manipulated in inline-edit-post.js
|
|
|
|
|
239 |
}
|
240 |
|
241 |
-
//
|
242 |
-
if (
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
$slug = $lang->slug;
|
248 |
-
foreach($terms as $key => $term) {
|
249 |
-
$lang = $this->get_term_language($term->term_id);
|
250 |
-
if (!$lang || ($lang->slug) != $slug)
|
251 |
-
unset($terms[$key]); // remove terms with no language set or different language
|
252 |
-
}
|
253 |
}
|
254 |
-
return $
|
255 |
}
|
256 |
|
257 |
// returns the language according to browser preference or the default language
|
258 |
function get_preferred_language() {
|
259 |
// check first is the user was already browsing this site
|
260 |
-
if (
|
261 |
-
return $
|
262 |
|
263 |
// sets the browsing language according to the browser preferences
|
264 |
// code adapted from http://www.thefutureoftheweb.com/blog/use-accept-language-header
|
@@ -285,7 +296,7 @@ class Polylang extends Polylang_Base {
|
|
285 |
foreach ($accept_langs as $accept_lang => $val) {
|
286 |
foreach ($listlanguages as $language) {
|
287 |
if (strpos($accept_lang, $language->slug) === 0 && !isset($pref_lang)) {
|
288 |
-
$pref_lang = $
|
289 |
}
|
290 |
}
|
291 |
}
|
@@ -354,7 +365,7 @@ class Polylang extends Polylang_Base {
|
|
354 |
return true; // prevents WP loading text domains as we will load them all later
|
355 |
}
|
356 |
|
357 |
-
// NOTE
|
358 |
// as done by xili_language and here : load text domains and reinitialize wp_locale with the action 'wp'
|
359 |
// as done by qtranslate : define the locale with the action 'plugins_loaded', but in this case, the language must be specified in the url.
|
360 |
function load_textdomains() {
|
@@ -363,13 +374,12 @@ class Polylang extends Polylang_Base {
|
|
363 |
setcookie('wordpress_polylang', $this->curlang->slug, time() + 31536000 /* 1 year */, COOKIEPATH, COOKIE_DOMAIN);
|
364 |
|
365 |
// our override_load_textdomain has done its job. let's remove it before calling load_textdomain
|
366 |
-
remove_filter('override_load_textdomain', array(&$this,'mofile'));
|
367 |
|
368 |
-
// now we can load text domains with the right language
|
369 |
-
|
370 |
-
|
371 |
-
load_textdomain( $textdomain['domain'], $mo);
|
372 |
-
}
|
373 |
|
374 |
global $wp_locale;
|
375 |
$wp_locale->init(); // reinitializes wp_locale for weekdays and months
|
@@ -400,12 +410,16 @@ class Polylang extends Polylang_Base {
|
|
400 |
}
|
401 |
}
|
402 |
|
|
|
|
|
403 |
// filters recent posts to the current language
|
404 |
-
if
|
|
|
|
|
|
|
405 |
$query->set('lang', $this->curlang->slug);
|
406 |
|
407 |
// remove pages from archives when the language is set
|
408 |
-
$qvars = $query->query_vars;
|
409 |
if (isset($qvars['m']) && isset($qvars['lang']))
|
410 |
$query->set('post_type', 'post');
|
411 |
}
|
@@ -414,7 +428,6 @@ class Polylang extends Polylang_Base {
|
|
414 |
// modifies the canonical link to the homepage
|
415 |
if (is_singular()) {
|
416 |
global $wp_the_query;
|
417 |
-
|
418 |
if ($id = $wp_the_query->get_queried_object_id()) {
|
419 |
if (is_page())
|
420 |
$link = _get_page_link($id); // ignores page_on_front unlike get_permalink
|
@@ -496,18 +509,33 @@ class Polylang extends Polylang_Base {
|
|
496 |
return $form;
|
497 |
}
|
498 |
|
499 |
-
// filters the pages according to the current language
|
|
|
|
|
|
|
500 |
function get_pages($pages, $r) {
|
501 |
if (isset($this->curlang)) {
|
502 |
foreach ($pages as $key => $page) {
|
503 |
$lang = $this->get_post_language($page->ID);
|
504 |
-
if ($this->curlang != $lang)
|
505 |
unset($pages[$key]);
|
506 |
}
|
507 |
}
|
508 |
return $pages;
|
509 |
}
|
510 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
511 |
// Modifies the feed link to add the language parameter
|
512 |
// FIXME should be an option to do this ?
|
513 |
function feed_link($url, $feed) {
|
@@ -609,6 +637,15 @@ class Polylang extends Polylang_Base {
|
|
609 |
return isset($url) ? $url : null;
|
610 |
}
|
611 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
// returns the home url in the right language
|
613 |
function get_home_url($language) {
|
614 |
$post_id = get_option('page_on_front');
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/polylang/
|
5 |
+
Version: 0.2
|
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.2');
|
27 |
+
define('POLYLANG_DIR', dirname(__FILE__));
|
28 |
+
require_once(POLYLANG_DIR.'/base.php');
|
29 |
+
require_once(POLYLANG_DIR.'/admin.php');
|
30 |
+
require_once(POLYLANG_DIR.'/widget.php');
|
31 |
|
32 |
class Polylang extends Polylang_Base {
|
33 |
var $curlang;
|
34 |
+
var $default_locale;
|
35 |
var $list_textdomains = array();
|
36 |
var $search_form_filter = false;
|
37 |
|
42 |
register_deactivation_hook( __FILE__, array(&$this, 'deactivate') );
|
43 |
|
44 |
// plugin and widget initialization
|
45 |
+
add_action('init', array(&$this, 'init'));
|
46 |
+
add_action('widgets_init', array(&$this, 'widgets_init'));
|
47 |
|
48 |
// rewrite rules
|
49 |
+
add_filter('rewrite_rules_array', array(&$this, 'rewrite_rules_array' ));
|
50 |
|
51 |
// filters categories and post tags by language
|
52 |
+
add_filter('terms_clauses', array(&$this, 'terms_clauses'), 10, 3);
|
53 |
|
54 |
if (is_admin())
|
55 |
new Polylang_Admin();
|
56 |
else {
|
57 |
// text domain management
|
58 |
+
add_filter('locale', array(&$this, 'get_locale'));
|
59 |
+
add_filter('override_load_textdomain', array(&$this, 'mofile'), 10, 3);
|
60 |
+
add_action('wp', array(&$this, 'load_textdomains'));
|
61 |
|
62 |
// filters posts according to the language
|
63 |
+
add_filter('pre_get_posts', array(&$this, 'pre_get_posts'));
|
64 |
|
65 |
// meta in the html head section
|
66 |
remove_action('wp_head', 'rel_canonical');
|
67 |
+
add_action('wp_head', array(&$this, 'wp_head'));
|
68 |
|
69 |
// prevents redirection of the homepage
|
70 |
+
add_filter('redirect_canonical', array(&$this, 'redirect_canonical'), 10, 2);
|
71 |
|
72 |
// adds javascript at the end of the document
|
73 |
+
add_action('wp_print_footer_scripts', array(&$this, 'wp_print_footer_scripts'));
|
74 |
|
75 |
// adds the language information in the search form
|
76 |
+
add_filter('get_search_form', array(&$this, 'get_search_form'));
|
77 |
|
78 |
// filters the pages according to the current language
|
79 |
+
add_filter('get_pages', array(&$this, 'get_pages'), 10, 2);
|
80 |
+
|
81 |
+
// filters the comments according to the current language
|
82 |
+
add_filter('comments_clauses', array(&$this, 'comments_clauses'));
|
83 |
|
84 |
// rewrites feed links to filter them by language
|
85 |
+
add_filter('feed_link', array(&$this, 'feed_link'), 10, 2);
|
86 |
|
87 |
// rewrites archives links to filter them by language
|
88 |
+
add_filter('getarchives_join', array(&$this, 'posts_join'));
|
89 |
+
add_filter('getarchives_where', array(&$this, 'posts_where'));
|
90 |
+
add_filter('get_archives_link', array(&$this, 'get_archives_link'));
|
91 |
|
92 |
// rewrites next and previous post links to filter them by language
|
93 |
+
add_filter('get_previous_post_join', array(&$this, 'posts_join'));
|
94 |
+
add_filter('get_next_post_join', array(&$this, 'posts_join'));
|
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 |
|
104 |
// Template tags
|
105 |
+
add_action('the_languages', array(&$this, 'the_languages'));
|
106 |
}
|
107 |
}
|
108 |
|
132 |
) $charset_collate;");
|
133 |
|
134 |
// codex tells to use the init action to call register_taxonomy but I need it now for my rewrite rules
|
135 |
+
register_taxonomy('language', array('post', 'page'), array('label' => false, 'query_var'=>'lang'));
|
136 |
|
137 |
// defines default values for options in case this is the first installation
|
138 |
$options = get_option('polylang');
|
140 |
$options['browser'] = 1; // default language for the front page is set by browser preference
|
141 |
$options['rewrite'] = 0; // do not remove /language/ in permalinks
|
142 |
}
|
143 |
+
$options['version'] = POLYLANG_VERSION; // do not manage versions yet but prepare for it
|
144 |
update_option('polylang', $options);
|
145 |
|
146 |
// add our rewrite rules
|
176 |
$wp_rewrite->extra_permastructs['language'][0] = '%language%';
|
177 |
}
|
178 |
|
179 |
+
$this->default_locale = get_locale(); // save the default locale before we start any language manipulation
|
180 |
load_plugin_textdomain('polylang', false, dirname(plugin_basename( __FILE__ ))); // plugin i18n
|
181 |
}
|
182 |
|
234 |
return $newrules + $rules;
|
235 |
}
|
236 |
|
237 |
+
// filters categories and post tags by language when needed (both in admin panels and frontend)
|
238 |
+
function terms_clauses($clauses, $taxonomies, $args) {
|
239 |
+
// does nothing except on categories and post tags
|
240 |
+
if ( !in_array('category', $taxonomies) && !in_array('post_tag', $taxonomies) )
|
241 |
+
return $clauses;
|
242 |
+
|
243 |
if (is_admin()) {
|
244 |
+
$screen = get_current_screen(); //FIXME breaks a user's admin -> use pagenow instead ? Or simply test the function.
|
245 |
+
|
246 |
+
// NOTE: $screen is not defined in the tag cloud of the Edit Post panel ($pagenow set to admin-ajax.php)
|
247 |
if (isset($screen))
|
248 |
// does nothing in the Categories, Post tags, Languages an Posts* admin panels
|
249 |
if ($screen->base == 'edit-tags' || $screen->base == 'toplevel_page_mlang' || $screen->base == 'edit')
|
250 |
+
return $clauses;
|
251 |
|
252 |
// *FIXME I want all categories in the dropdown list and only the ones in the right language in the inline edit
|
253 |
// It seems that I need javascript to get the post_id as inline edit data are manipulated in inline-edit-post.js
|
254 |
+
|
255 |
+
$this->curlang = $this->get_current_language();
|
256 |
}
|
257 |
|
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 = $value";
|
|
|
|
|
|
|
|
|
|
|
|
|
264 |
}
|
265 |
+
return $clauses;
|
266 |
}
|
267 |
|
268 |
// returns the language according to browser preference or the default language
|
269 |
function get_preferred_language() {
|
270 |
// check first is the user was already browsing this site
|
271 |
+
if (isset($_COOKIE['wordpress_polylang']))
|
272 |
+
return $this->get_language($_COOKIE['wordpress_polylang']);
|
273 |
|
274 |
// sets the browsing language according to the browser preferences
|
275 |
// code adapted from http://www.thefutureoftheweb.com/blog/use-accept-language-header
|
296 |
foreach ($accept_langs as $accept_lang => $val) {
|
297 |
foreach ($listlanguages as $language) {
|
298 |
if (strpos($accept_lang, $language->slug) === 0 && !isset($pref_lang)) {
|
299 |
+
$pref_lang = $language;
|
300 |
}
|
301 |
}
|
302 |
}
|
365 |
return true; // prevents WP loading text domains as we will load them all later
|
366 |
}
|
367 |
|
368 |
+
// NOTE: I believe there are two ways for a plugin to force the WP language
|
369 |
// as done by xili_language and here : load text domains and reinitialize wp_locale with the action 'wp'
|
370 |
// as done by qtranslate : define the locale with the action 'plugins_loaded', but in this case, the language must be specified in the url.
|
371 |
function load_textdomains() {
|
374 |
setcookie('wordpress_polylang', $this->curlang->slug, time() + 31536000 /* 1 year */, COOKIEPATH, COOKIE_DOMAIN);
|
375 |
|
376 |
// our override_load_textdomain has done its job. let's remove it before calling load_textdomain
|
377 |
+
remove_filter('override_load_textdomain', array(&$this, 'mofile'));
|
378 |
|
379 |
+
// now we can load text domains with the right language
|
380 |
+
$new_locale = get_locale();
|
381 |
+
foreach ($this->list_textdomains as $textdomain)
|
382 |
+
load_textdomain( $textdomain['domain'], str_replace($this->default_locale, $new_locale, $textdomain['mo']));
|
|
|
383 |
|
384 |
global $wp_locale;
|
385 |
$wp_locale->init(); // reinitializes wp_locale for weekdays and months
|
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 from archives when the language is set
|
|
|
423 |
if (isset($qvars['m']) && isset($qvars['lang']))
|
424 |
$query->set('post_type', 'post');
|
425 |
}
|
428 |
// modifies the canonical link to the homepage
|
429 |
if (is_singular()) {
|
430 |
global $wp_the_query;
|
|
|
431 |
if ($id = $wp_the_query->get_queried_object_id()) {
|
432 |
if (is_page())
|
433 |
$link = _get_page_link($id); // ignores page_on_front unlike get_permalink
|
509 |
return $form;
|
510 |
}
|
511 |
|
512 |
+
// filters the list of pages according to the current language
|
513 |
+
// FIXME: it seems that there is currently no way to filter before the database query (3.2) -> lot of sql queries
|
514 |
+
// cannot play with widget_pages_args filter either as it seems that get_pages does not query taxonomies :(
|
515 |
+
// should try to improve this...
|
516 |
function get_pages($pages, $r) {
|
517 |
if (isset($this->curlang)) {
|
518 |
foreach ($pages as $key => $page) {
|
519 |
$lang = $this->get_post_language($page->ID);
|
520 |
+
if (!$lang || $this->curlang->slug != $lang->slug)
|
521 |
unset($pages[$key]);
|
522 |
}
|
523 |
}
|
524 |
return $pages;
|
525 |
}
|
526 |
|
527 |
+
// filters the comments according to the current language
|
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 = $value";
|
535 |
+
}
|
536 |
+
return $clauses;
|
537 |
+
}
|
538 |
+
|
539 |
// Modifies the feed link to add the language parameter
|
540 |
// FIXME should be an option to do this ?
|
541 |
function feed_link($url, $feed) {
|
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) {
|
651 |
$post_id = get_option('page_on_front');
|
polylang.pot
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: polylang\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2011-10-04 12:14+0100\n"
|
6 |
+
"PO-Revision-Date: \n"
|
7 |
+
"Last-Translator: F. Demarle\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"Language: \n"
|
10 |
+
"MIME-Version: 1.0\n"
|
11 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
+
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"Plural-Forms: nplurals=2: nplural=n>1\n"
|
14 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
+
"X-Poedit-KeywordsList: _e;__;_c\n"
|
16 |
+
"X-Poedit-Basepath: .\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:255
|
21 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:422
|
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
|
25 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:5
|
26 |
+
msgid "Language"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/edit-term-form.php:13
|
30 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/add-term-form.php:10
|
31 |
+
msgid "Sets the language"
|
32 |
+
msgstr ""
|
33 |
+
|
34 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/widget.php:5
|
35 |
+
msgid "Displays a language switcher"
|
36 |
+
msgstr ""
|
37 |
+
|
38 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/widget.php:6
|
39 |
+
msgid "Language Switcher"
|
40 |
+
msgstr ""
|
41 |
+
|
42 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:70
|
43 |
+
msgid "Settings"
|
44 |
+
msgstr ""
|
45 |
+
|
46 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:77
|
47 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:300
|
48 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:301
|
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:291
|
55 |
+
msgid "Show all languages"
|
56 |
+
msgstr ""
|
57 |
+
|
58 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:514
|
59 |
+
msgid "Theme locations and languages"
|
60 |
+
msgstr ""
|
61 |
+
|
62 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/admin.php:519
|
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 ""
|
70 |
+
|
71 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-metabox.php:3
|
72 |
+
msgid "Post's language:"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:6
|
76 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:10
|
77 |
+
msgid "Translations"
|
78 |
+
msgstr ""
|
79 |
+
|
80 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/term-translations.php:16
|
81 |
+
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:52
|
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:42
|
93 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:22
|
94 |
+
msgid "Add new"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:31
|
98 |
+
msgid "Delete"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:48
|
102 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:46
|
103 |
+
msgid "Full name"
|
104 |
+
msgstr ""
|
105 |
+
|
106 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:49
|
107 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:52
|
108 |
+
msgid "Locale"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:50
|
112 |
+
msgid "Code"
|
113 |
+
msgstr ""
|
114 |
+
|
115 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/list-table.php:51
|
116 |
+
msgid "Posts"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:29
|
120 |
+
msgid "Edit language"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:29
|
124 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:66
|
125 |
+
msgid "Add new language"
|
126 |
+
msgstr ""
|
127 |
+
|
128 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:48
|
129 |
+
msgid "The name is how it is displayed on your site (for example: English)."
|
130 |
+
msgstr ""
|
131 |
+
|
132 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:54
|
133 |
+
msgid "Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language."
|
134 |
+
msgstr ""
|
135 |
+
|
136 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:58
|
137 |
+
msgid "Language code"
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:60
|
141 |
+
msgid "2-letters ISO 639-1 language code (for example: en)"
|
142 |
+
msgstr ""
|
143 |
+
|
144 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:64
|
145 |
+
msgid "Update"
|
146 |
+
msgstr ""
|
147 |
+
|
148 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:76
|
149 |
+
msgid "Menus"
|
150 |
+
msgstr ""
|
151 |
+
|
152 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:84
|
153 |
+
msgid "Theme location"
|
154 |
+
msgstr ""
|
155 |
+
|
156 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:118
|
157 |
+
msgid "Options"
|
158 |
+
msgstr ""
|
159 |
+
|
160 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/languages-form.php:128
|
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:134
|
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:139
|
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:141
|
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:142
|
177 |
+
msgid "otherwise: "
|
178 |
+
msgstr ""
|
179 |
+
|
180 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:2
|
181 |
+
msgid "ID of posts in other languages:"
|
182 |
+
msgstr ""
|
183 |
+
|
184 |
+
#: /home/fred/Documents/Web/test-flabellina.com/wordpress/wp-content/plugins/polylang/post-translations.php:6
|
185 |
+
msgid "Post ID"
|
186 |
+
msgstr ""
|
187 |
+
|
188 |
+
#~ msgid "Title:"
|
189 |
+
#~ msgstr "Titre :"
|
190 |
+
|
post-metabox.php
CHANGED
@@ -1,40 +1,17 @@
|
|
1 |
-
<?php // allowing to choose the post's language
|
|
|
2 |
<p><em><?php $post_type == 'page' ? _e('Page\'s language:', 'polylang') : _e('Post\'s language:', 'polylang');?></em></p>
|
3 |
-
<p
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
printf(
|
8 |
} ?>
|
|
|
9 |
</p>
|
10 |
-
|
11 |
<?php // allowing to determine the linked posts
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
<th><?php _e('Language', 'polylang');?></th>
|
17 |
-
<th><?php _e('Post ID', 'polylang');?></th>
|
18 |
-
<th><?php _e('Edit', 'polylang');?></th>
|
19 |
-
</tr></thead>
|
20 |
-
|
21 |
-
<tbody>
|
22 |
-
<?php foreach ($listlanguages as $language) {
|
23 |
-
if ($language != $lang) {
|
24 |
-
$value = $this->get_translated_post($post_ID, $language);
|
25 |
-
if (isset($_GET['from_post']))
|
26 |
-
$value = $this->get_post($_GET['from_post'], $language); ?>
|
27 |
-
<tr>
|
28 |
-
<td style="font-size: 11px;"><?php echo $language->name;?></td>
|
29 |
-
<td><input name="<?php echo $language->slug;?>" id="<?php echo $language->slug;?>" type="text" value="<?php echo $value;?>" size="6"/></td><?php
|
30 |
-
if ($lang) {
|
31 |
-
$link = $value ?
|
32 |
-
sprintf('<a href="post.php?action=edit&post=%s">%s</a>', $value, __('Edit','polylang')) :
|
33 |
-
sprintf('<a href="post-new.php?from_post=%s&new_lang=%s">%s</a>',$post_ID, $language->slug, __('Add new','polylang')); ?>
|
34 |
-
<td style="font-size: 11px;"><?php echo $link ?><td><?php
|
35 |
-
}?>
|
36 |
-
</tr><?php
|
37 |
-
}
|
38 |
-
} ?>
|
39 |
-
</tbody>
|
40 |
-
</table>
|
1 |
+
<?php // allowing to choose the post's language
|
2 |
+
// NOTE: the class "tags-input" allows to include the field in the autosave $_POST (see autosave.js)?>
|
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("<option value='%s'%s>%s</option>\n", $language->slug, $language == $lang ? ' selected="selected"' : '', $language->name);
|
9 |
} ?>
|
10 |
+
</select><br />
|
11 |
</p>
|
12 |
+
<div id="post-translations">
|
13 |
<?php // allowing to determine the linked posts
|
14 |
+
if (isset($lang))
|
15 |
+
include(POLYLANG_DIR.'/post-translations.php');
|
16 |
+
?>
|
17 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
post-translations.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php // FIXME inline CSS ! ?>
|
2 |
+
<p><em><?php _e('ID of posts in other languages:', 'polylang');?></em></p>
|
3 |
+
<table style="width: 100%; text-align: left; font-size: 11px; margin: 0 6px;">
|
4 |
+
<thead><tr>
|
5 |
+
<th><?php _e('Language', 'polylang');?></th>
|
6 |
+
<th><?php _e('Post ID', 'polylang');?></th>
|
7 |
+
<th><?php _e('Edit', 'polylang');?></th>
|
8 |
+
</tr></thead>
|
9 |
+
|
10 |
+
<tbody>
|
11 |
+
<?php foreach ($listlanguages as $language) {
|
12 |
+
if ($language != $lang) {
|
13 |
+
$value = $this->get_translated_post($post_ID, $language);
|
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('<td><input name="%s" id="%s" class="tags-input" type="text" value="%s" size="6"/></td>', $language->slug, $language->slug, $value);
|
19 |
+
if ($lang) {
|
20 |
+
$link = $value ?
|
21 |
+
sprintf('<a href="post.php?action=edit&post=%s">%s</a>', $value, __('Edit','polylang')) :
|
22 |
+
sprintf('<a href="post-new.php?from_post=%s&new_lang=%s">%s</a>',$post_ID, $language->slug, __('Add new','polylang')); ?>
|
23 |
+
<td style="font-size: 11px;"><?php echo $link ?><td><?php
|
24 |
+
}?>
|
25 |
+
</tr><?php
|
26 |
+
}
|
27 |
+
} ?>
|
28 |
+
</tbody>
|
29 |
+
</table>
|
readme.txt
CHANGED
@@ -1,25 +1,40 @@
|
|
1 |
-
===
|
2 |
Contributors: Chouby
|
3 |
-
Tags: bilingual, multilingual, language, i18n, l10n, international
|
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 |
-
|
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, it 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 |
-
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
== Installation ==
|
25 |
|
@@ -29,7 +44,8 @@ This is the initial version. Although I tested it carefully, there are probably
|
|
29 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
30 |
1. Add the 'language switcher' Widget to let your visitors switch the language.
|
31 |
1. Go to the languages settings page and create the languages you need
|
32 |
-
1. Upload corresponding .mo files in WordPress languages directory (no need for English). You can download it from [here](http://svn.automattic.com/wordpress-i18n/).
|
|
|
33 |
|
34 |
== Frequently Asked Questions ==
|
35 |
|
@@ -37,20 +53,20 @@ This is the initial version. Although I tested it carefully, there are probably
|
|
37 |
|
38 |
WPML: I tested only the last non-commercial version with WP 3.0.5. The plugin looks quite complete. It's however very heavy (almost 30000 lines of code !). The fact that it has turned commercial is probably adapted to companies or very active bloggers but not well adapted to small blogs.
|
39 |
|
40 |
-
Xili language: I tested the version 2.2.0. It looks too complex. For example you need to install 3 different plugins to manage post tags translation. If managing post translations is quite easy (and inspired Polylang...), the way to manage categories and post tags translations is not enough user friendly
|
41 |
|
42 |
qtranslate: I tested the version 2.5.23. As claimed by its author, it's probably the best existing plugin... when using it. However, you must know that it is very difficult to come back to a clean site if you deactivate it (as, for example, one post in the database contains all translations). Moreover, it modifies urls so again, if you deactivate it, all links to your internal urls would be broken (not good for SEO).
|
43 |
|
44 |
In comparison to these plugins, Polylang tries to keep things simple and light, and does not mess your blog if you deactivate it. But it is still very young so be indulgent ;-)
|
45 |
|
46 |
-
=
|
47 |
|
48 |
Your theme uses the template searchform.php (as Twenty Eleven does) or hardcoded the search form and javascript is disabled. Unfortunately Polylang currently does not support this. So you have the following alternatives to get the things work well:
|
49 |
|
50 |
* Use the 'get_search_form' function and place your custom search form in functions.php as described in the [codex](http://codex.wordpress.org/Function_Reference/get_search_form). The plugin also works well if you use the default search form provided by WordPress.
|
51 |
* Enable javascript (unfortunately you can't control this for your visitors so the first solution is better)
|
52 |
|
53 |
-
=
|
54 |
|
55 |
The plugin is not compatible with the calendar widget. The calendar displays well but it does not link to posts filtered in the right language. Consider using the Archives widget instead.
|
56 |
|
@@ -71,6 +87,16 @@ You MUST define a language for all your categories and post tags otherwise they
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 0.1 =
|
75 |
* Initial release
|
76 |
|
1 |
+
=== Polylang ===
|
2 |
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.2
|
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 ! I 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, it 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 |
|
18 |
+
* You can create as many languages as you want
|
19 |
+
* You can translate posts, pages, categories, post tags, menus
|
20 |
+
* RSS feed available for each language
|
21 |
+
* Support for Search form (see FAQ)
|
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 !).
|
34 |
+
|
35 |
+
= Feedback or ideas =
|
36 |
+
|
37 |
+
You use the plugin or just tested it ? Don't hesitate to [give your feedback](http://wordpress.org/tags/polylang?forum_id=10)
|
38 |
|
39 |
== Installation ==
|
40 |
|
44 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
45 |
1. Add the 'language switcher' Widget to let your visitors switch the language.
|
46 |
1. Go to the languages settings page and create the languages you need
|
47 |
+
1. Upload corresponding .mo files in WordPress languages directory (no need for English). You can download it from [here](http://svn.automattic.com/wordpress-i18n/).
|
48 |
+
1. Take care that your theme must come with the corresponding .mo file too. If your theme is not internationalized yet, please refer to the [codex](http://codex.wordpress.org/I18n_for_WordPress_Developers#I18n_for_theme_and_plugin_developers) or ask the theme author to internationalize it.
|
49 |
|
50 |
== Frequently Asked Questions ==
|
51 |
|
53 |
|
54 |
WPML: I tested only the last non-commercial version with WP 3.0.5. The plugin looks quite complete. It's however very heavy (almost 30000 lines of code !). The fact that it has turned commercial is probably adapted to companies or very active bloggers but not well adapted to small blogs.
|
55 |
|
56 |
+
Xili language: I tested the version 2.2.0. It looks too complex. For example you need to install 3 different plugins to manage post tags translation. If managing post translations is quite easy (and inspired Polylang...), the way to manage categories and post tags translations is not enough user friendly in my opinion. As WPML it's very heavy (about 12000 lines of code).
|
57 |
|
58 |
qtranslate: I tested the version 2.5.23. As claimed by its author, it's probably the best existing plugin... when using it. However, you must know that it is very difficult to come back to a clean site if you deactivate it (as, for example, one post in the database contains all translations). Moreover, it modifies urls so again, if you deactivate it, all links to your internal urls would be broken (not good for SEO).
|
59 |
|
60 |
In comparison to these plugins, Polylang tries to keep things simple and light, and does not mess your blog if you deactivate it. But it is still very young so be indulgent ;-)
|
61 |
|
62 |
+
= The language filter is lost when using the search form =
|
63 |
|
64 |
Your theme uses the template searchform.php (as Twenty Eleven does) or hardcoded the search form and javascript is disabled. Unfortunately Polylang currently does not support this. So you have the following alternatives to get the things work well:
|
65 |
|
66 |
* Use the 'get_search_form' function and place your custom search form in functions.php as described in the [codex](http://codex.wordpress.org/Function_Reference/get_search_form). The plugin also works well if you use the default search form provided by WordPress.
|
67 |
* Enable javascript (unfortunately you can't control this for your visitors so the first solution is better)
|
68 |
|
69 |
+
= The language filter is lost when using the calendar widget =
|
70 |
|
71 |
The plugin is not compatible with the calendar widget. The calendar displays well but it does not link to posts filtered in the right language. Consider using the Archives widget instead.
|
72 |
|
87 |
|
88 |
== Changelog ==
|
89 |
|
90 |
+
= 0.2 =
|
91 |
+
|
92 |
+
* Add language filter for nav menus
|
93 |
+
* Add German translation
|
94 |
+
* Add language filter for recent comments
|
95 |
+
* Add ajax to term edit form
|
96 |
+
* Add ajax to post metabox
|
97 |
+
* Improved performance for filtering terms by language
|
98 |
+
* Bugs correction
|
99 |
+
|
100 |
= 0.1 =
|
101 |
* Initial release
|
102 |
|
term-translations.php
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// displays the translations fields
|
3 |
+
// FIXME inline CSS
|
4 |
+
|
5 |
+
if (isset($term_id)) { // edit term form?>
|
6 |
+
<th scope="row" valign="top"><?php _e('Translations', 'polylang');?></th>
|
7 |
+
<td><?php
|
8 |
+
}
|
9 |
+
else { // add term form?>
|
10 |
+
<label><?php _e('Translations', 'polylang');?></label><?php
|
11 |
+
}
|
12 |
+
?>
|
13 |
+
<table style="width: 100%">
|
14 |
+
<thead><tr><?php
|
15 |
+
$style = 'style="padding: 0px; font-weight: bold; text-align: left"';
|
16 |
+
foreach (array(__('Language', 'polylang'), __('Translation', 'polylang'), __('Edit', 'polylang')) as $title)
|
17 |
+
printf('<th %s>%s</th>', $style, $title);?>
|
18 |
+
</tr></thead>
|
19 |
+
<tbody>
|
20 |
+
<?php foreach ($listlanguages as $language) {
|
21 |
+
$translation = 0;
|
22 |
+
|
23 |
+
// look for any existing translation in this language
|
24 |
+
if ($language != $lang) {
|
25 |
+
if (isset($term_id) && $translation_id = $this->get_translated_term($term_id, $language))
|
26 |
+
$translation = get_term($translation_id, $taxonomy);
|
27 |
+
if (isset($_GET['from_tag']) && isset($_GET['from_lang'])) {
|
28 |
+
if ($_GET['from_lang'] == $language->slug)
|
29 |
+
$translation = get_term($_GET['from_tag'], $taxonomy);
|
30 |
+
elseif ($translation_id = $this->get_translated_term($_GET['from_tag'], $language))
|
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
|
48 |
+
}
|
49 |
+
else { ?>
|
50 |
+
<td style="padding: 0px">
|
51 |
+
</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 |
+
printf('<a href="edit-tags.php?taxonomy=%s&from_tag=%s&from_lang=%s&new_lang=%s">%s</a>',
|
57 |
+
$taxonomy, $term_id, $lang->slug, $language->slug, __('Add new','polylang')) ?>
|
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 |
+
<?php printf('<a href="edit-tags.php?action=edit&taxonomy=%s&tag_ID=%s">%s</a>', $taxonomy, $translation->term_id, __('Edit','polylang')) ?>
|
66 |
+
</td><?php
|
67 |
+
} ?>
|
68 |
+
</tr><?php
|
69 |
+
} // if (!$value)
|
70 |
+
} // foreach ?>
|
71 |
+
</tbody>
|
72 |
+
</table>
|
73 |
+
<?php if (isset($term_id)) { // edit term form?>
|
74 |
+
</td><?php
|
75 |
+
}
|
uninstall.php
CHANGED
@@ -5,6 +5,7 @@ $wpdb->termmeta = $wpdb->prefix . 'termmeta'; // registers the termmeta table in
|
|
5 |
register_taxonomy('language', 'post', array('label' => false, 'query_var'=>'lang')); // temporarily register the language taxonomy
|
6 |
|
7 |
$languages = get_terms('language', array('hide_empty'=>false));
|
|
|
8 |
foreach ($languages as $lang) {
|
9 |
// delete references to this language in all posts
|
10 |
$args = array('numberposts'=> -1, 'post_type'=>'any', 'post_status'=>'any');
|
@@ -30,7 +31,8 @@ if (!$count) {
|
|
30 |
unset($wpdb->termmeta);
|
31 |
}
|
32 |
|
33 |
-
//
|
34 |
delete_option('polylang');
|
35 |
-
delete_option('
|
|
|
36 |
?>
|
5 |
register_taxonomy('language', 'post', array('label' => false, 'query_var'=>'lang')); // temporarily register the language taxonomy
|
6 |
|
7 |
$languages = get_terms('language', array('hide_empty'=>false));
|
8 |
+
|
9 |
foreach ($languages as $lang) {
|
10 |
// delete references to this language in all posts
|
11 |
$args = array('numberposts'=> -1, 'post_type'=>'any', 'post_status'=>'any');
|
31 |
unset($wpdb->termmeta);
|
32 |
}
|
33 |
|
34 |
+
// delete options
|
35 |
delete_option('polylang');
|
36 |
+
delete_option('polylang_nav_menus');
|
37 |
+
delete_option('widget_polylang_widget'); // automatically created by WP
|
38 |
?>
|