Polylang - Version 0.6.1

Version Description

  • Add Dutch translation contributed by AlbertGn
  • Disable everything except the languages management panel while no language has been created
  • Bug correction: can't have the same featured image in translated posts
  • Bug correction: parent page dropdown does appear only after the page has been saved
  • Bug correction: archives widget not working anymore
  • Bug correction: string translations does not work for WP < 3.3
  • Bug correction: fix fatal error in string translations caused by widgets using the old API
  • Bug correction: the strings translation panel is unable to translate strings with special characters
  • Bug correction: Polylang "is_front_page" returns true on archives pages
Download this release

Release Info

Developer Chouby
Plugin Icon 128x128 Polylang
Version 0.6.1
Comparing to
See all releases

Code changes from version 0.6 to 0.6.1

doc/documentation-en.odt CHANGED
Binary file
doc/documentation-en.pdf CHANGED
Binary file
include/admin-filters.php CHANGED
@@ -2,13 +2,30 @@
2
 
3
  // all modifications of the WordPress admin ui
4
  class Polylang_Admin_Filters extends Polylang_Base {
 
 
5
  function __construct() {
 
 
 
 
6
  // additionnal filters and actions
7
  add_action('admin_init', array(&$this, 'admin_init'));
8
-
9
  // setup js scripts andd css styles
10
  add_action('admin_enqueue_scripts', array(&$this,'admin_enqueue_scripts'));
11
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  // add the language and translations columns (as well as a filter by language) in 'All Posts' an 'All Pages' panels
13
  add_filter('manage_posts_columns', array(&$this, 'add_post_column'), 10, 2);
14
  add_filter('manage_pages_columns', array(&$this, 'add_post_column'));
@@ -35,6 +52,21 @@ class Polylang_Admin_Filters extends Polylang_Base {
35
  // filters categories and post tags by language
36
  add_filter('terms_clauses', array(&$this, 'terms_clauses'), 10, 3);
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  // adds actions related to languages when saving categories and post tags
39
  add_action('created_term', array(&$this, 'save_term'), 10, 3);
40
  add_action('edited_term', array(&$this, 'save_term'), 10, 3);
@@ -50,30 +82,8 @@ class Polylang_Admin_Filters extends Polylang_Base {
50
  add_filter('widget_update_callback', array(&$this, 'widget_update_callback'), 10, 4);
51
 
52
  // language management for users
53
- add_filter('locale', array(&$this, 'get_locale'));
54
  add_action('personal_options_update', array(&$this, 'personal_options_update'));
55
  add_action('personal_options', array(&$this, 'personal_options'));
56
-
57
- // refresh rewrite rules if the 'page_on_front' option is modified
58
- add_action('update_option', array(&$this, 'update_option'));
59
- }
60
-
61
- // add these actions and filters here and not in the constructor to be sure that all taxonomies are registered
62
- function admin_init() {
63
- foreach (get_taxonomies(array('show_ui'=>true)) as $tax) {
64
- // adds the language field in the 'Categories' and 'Post Tags' panels
65
- add_action($tax.'_add_form_fields', array(&$this, 'add_term_form'));
66
-
67
- // adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels
68
- add_action($tax.'_edit_form_fields', array(&$this, 'edit_term_form'));
69
-
70
- // adds the language column in the 'Categories' and 'Post Tags' tables
71
- add_filter('manage_edit-'.$tax.'_columns', array(&$this, 'add_term_column'));
72
- add_action('manage_'.$tax.'_custom_column', array(&$this, 'term_column'), 10, 3);
73
-
74
- // adds action related to languages when deleting categories and post tags
75
- add_action('delete_'.$tax, array(&$this, 'delete_term'));
76
- }
77
  }
78
 
79
  // setup js scripts & css styles
@@ -160,8 +170,9 @@ class Polylang_Admin_Filters extends Polylang_Base {
160
 
161
  // adds the Languages box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels
162
  function add_meta_boxes() {
163
- foreach(get_post_types( array( 'show_ui' => true ) ) as $ptype)
164
- add_meta_box('ml_box', __('Languages','polylang'), array(&$this,'post_language'), $ptype, 'side','high');
 
165
  }
166
 
167
  // the Languages metabox in the 'Edit Post' and 'Edit Page' panels
@@ -173,10 +184,8 @@ class Polylang_Admin_Filters extends Polylang_Base {
173
  if (isset($_GET['new_lang']))
174
  $lang = $this->get_language($_GET['new_lang']);
175
 
176
- if (!isset($lang)) {
177
- $options = get_option('polylang');
178
- $lang = $this->get_language($options['default_lang']);
179
- }
180
 
181
  $listlanguages = $this->get_languages_list();
182
 
@@ -249,7 +258,7 @@ class Polylang_Admin_Filters extends Polylang_Base {
249
  // filters the pages by language in the parent dropdown list in the page attributes metabox
250
  function page_attributes_dropdown_pages_args($dropdown_args, $post) {
251
  $lang = isset($_POST['lang']) ? $this->get_language($_POST['lang']) : $this->get_post_language($post->ID); // ajax or not ?
252
- $pages = implode(',', $this->exclude_pages($lang));
253
  $dropdown_args['exclude'] = isset($dropdown_args['exclude']) ? $dropdown_args['exclude'].','.$pages : $pages;
254
  return $dropdown_args;
255
  }
@@ -284,6 +293,14 @@ class Polylang_Admin_Filters extends Polylang_Base {
284
  if ($id = wp_is_post_revision($post_id))
285
  $post_id = $id;
286
 
 
 
 
 
 
 
 
 
287
  // the hook is called when the post is created
288
  // let's use it to initialize some things when using "Add new" (translation)
289
  if (isset($_GET['from_post']) && isset($_GET['new_lang'])) {
@@ -313,8 +330,7 @@ class Polylang_Admin_Filters extends Polylang_Base {
313
  if (!isset($_POST['post_lang_choice']))
314
  return;
315
 
316
- // save language and translations
317
- $this->set_post_language($post_id, $_POST['post_lang_choice']);
318
  $this->save_translations('post', $post_id, $_POST['post_tr_lang']);
319
 
320
  // synchronise terms and metas in translations
@@ -343,10 +359,10 @@ class Polylang_Admin_Filters extends Polylang_Base {
343
  wp_set_object_terms($tr_id, $newterms, $tax); // replace terms in translation
344
  }
345
 
346
- // copy metas and allow plugins to do the same
347
  $metas = apply_filters('pll_copy_metas', array('_wp_page_template', '_thumbnail_id'));
348
  foreach ($metas as $meta) {
349
- if ($value = get_post_meta($_GET['from_post'], $meta, true))
350
  update_post_meta($tr_id, $meta, get_post_meta($post_id, $meta, true));
351
  else
352
  delete_post_meta($tr_id, $meta);
@@ -355,7 +371,7 @@ class Polylang_Admin_Filters extends Polylang_Base {
355
  // post parent
356
  if ($parent_id = wp_get_post_parent_id($post_id));
357
  $post_parent = $this->get_translation('post', $parent_id, $lang);
358
-
359
  global $wpdb;
360
  $wpdb->update($wpdb->posts, array('post_parent'=> isset($post_parent) ? $post_parent : 0), array( 'ID' => $tr_id ));
361
  }
@@ -394,7 +410,6 @@ class Polylang_Admin_Filters extends Polylang_Base {
394
  return $clauses;
395
 
396
  global $post_ID;
397
- $options = get_option('polylang');
398
 
399
  // ajax response for changing the language in the post metabox
400
  if (isset($_POST['lang']))
@@ -413,7 +428,7 @@ class Polylang_Admin_Filters extends Polylang_Base {
413
 
414
  // for a new post
415
  elseif ($screen->base == 'post' && !PLL_DISPLAY_ALL)
416
- $lang = $this->get_language($options['default_lang']);
417
 
418
  // adds our clauses to filter by current language
419
  return isset($lang) ? $this->_terms_clauses($clauses, $lang) : $clauses;
@@ -425,10 +440,8 @@ class Polylang_Admin_Filters extends Polylang_Base {
425
 
426
  if (isset($_GET['new_lang']))
427
  $lang = $this->get_language($_GET['new_lang']);
428
- else {
429
- $options = get_option('polylang');
430
- $lang = $this->get_language($options['default_lang']);
431
- }
432
 
433
  $listlanguages = $this->get_languages_list();
434
 
@@ -510,7 +523,7 @@ class Polylang_Admin_Filters extends Polylang_Base {
510
 
511
  // synchronize translations of this term in all posts
512
 
513
- // get all posts associated to this term
514
  $posts = get_posts(array(
515
  'numberposts'=>-1,
516
  'post_type' => 'any',
@@ -528,7 +541,7 @@ class Polylang_Admin_Filters extends Polylang_Base {
528
  if ($translated_term = $this->get_term($term_id, $language)) {
529
  foreach ($posts as $post_id) {
530
  if ($translated_post = $this->get_post($post_id, $language))
531
- wp_set_object_terms($translated_post, $translated_term, $taxonomy, true);
532
  }
533
  }
534
  }
2
 
3
  // all modifications of the WordPress admin ui
4
  class Polylang_Admin_Filters extends Polylang_Base {
5
+ private $options;
6
+
7
  function __construct() {
8
+
9
+ // init options often needed
10
+ $this->options = get_option('polylang');
11
+
12
  // additionnal filters and actions
13
  add_action('admin_init', array(&$this, 'admin_init'));
 
14
  // setup js scripts andd css styles
15
  add_action('admin_enqueue_scripts', array(&$this,'admin_enqueue_scripts'));
16
 
17
+ // filter admin language for users
18
+ add_filter('locale', array(&$this, 'get_locale'));
19
+
20
+ // refresh rewrite rules if the 'page_on_front' option is modified
21
+ add_action('update_option', array(&$this, 'update_option'));
22
+ }
23
+
24
+ // add these actions and filters here and not in the constructor to be sure that all taxonomies are registered
25
+ function admin_init() {
26
+ if (!$this->get_languages_list())
27
+ return;
28
+
29
  // add the language and translations columns (as well as a filter by language) in 'All Posts' an 'All Pages' panels
30
  add_filter('manage_posts_columns', array(&$this, 'add_post_column'), 10, 2);
31
  add_filter('manage_pages_columns', array(&$this, 'add_post_column'));
52
  // filters categories and post tags by language
53
  add_filter('terms_clauses', array(&$this, 'terms_clauses'), 10, 3);
54
 
55
+ foreach (get_taxonomies(array('show_ui'=>true)) as $tax) {
56
+ // adds the language field in the 'Categories' and 'Post Tags' panels
57
+ add_action($tax.'_add_form_fields', array(&$this, 'add_term_form'));
58
+
59
+ // adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels
60
+ add_action($tax.'_edit_form_fields', array(&$this, 'edit_term_form'));
61
+
62
+ // adds the language column in the 'Categories' and 'Post Tags' tables
63
+ add_filter('manage_edit-'.$tax.'_columns', array(&$this, 'add_term_column'));
64
+ add_action('manage_'.$tax.'_custom_column', array(&$this, 'term_column'), 10, 3);
65
+
66
+ // adds action related to languages when deleting categories and post tags
67
+ add_action('delete_'.$tax, array(&$this, 'delete_term'));
68
+ }
69
+
70
  // adds actions related to languages when saving categories and post tags
71
  add_action('created_term', array(&$this, 'save_term'), 10, 3);
72
  add_action('edited_term', array(&$this, 'save_term'), 10, 3);
82
  add_filter('widget_update_callback', array(&$this, 'widget_update_callback'), 10, 4);
83
 
84
  // language management for users
 
85
  add_action('personal_options_update', array(&$this, 'personal_options_update'));
86
  add_action('personal_options', array(&$this, 'personal_options'));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
  // setup js scripts & css styles
170
 
171
  // adds the Languages box in the 'Edit Post' and 'Edit Page' panels (as well as in custom post types panels
172
  function add_meta_boxes() {
173
+ if ($this->get_languages_list())
174
+ foreach(get_post_types( array( 'show_ui' => true ) ) as $ptype)
175
+ add_meta_box('ml_box', __('Languages','polylang'), array(&$this,'post_language'), $ptype, 'side','high');
176
  }
177
 
178
  // the Languages metabox in the 'Edit Post' and 'Edit Page' panels
184
  if (isset($_GET['new_lang']))
185
  $lang = $this->get_language($_GET['new_lang']);
186
 
187
+ if (!isset($lang))
188
+ $lang = $this->get_language($this->options['default_lang']);
 
 
189
 
190
  $listlanguages = $this->get_languages_list();
191
 
258
  // filters the pages by language in the parent dropdown list in the page attributes metabox
259
  function page_attributes_dropdown_pages_args($dropdown_args, $post) {
260
  $lang = isset($_POST['lang']) ? $this->get_language($_POST['lang']) : $this->get_post_language($post->ID); // ajax or not ?
261
+ $pages = implode(',', $this->exclude_pages($lang->term_id));
262
  $dropdown_args['exclude'] = isset($dropdown_args['exclude']) ? $dropdown_args['exclude'].','.$pages : $pages;
263
  return $dropdown_args;
264
  }
293
  if ($id = wp_is_post_revision($post_id))
294
  $post_id = $id;
295
 
296
+ // save language
297
+ if (isset($_POST['post_lang_choice']))
298
+ $this->set_post_language($post_id, $_POST['post_lang_choice']);
299
+ elseif (isset($_GET['new_lang']))
300
+ $this->set_post_language($post_id, $_GET['new_lang']);
301
+ else
302
+ $this->set_post_language($post_id, $this->options['default_lang']);
303
+
304
  // the hook is called when the post is created
305
  // let's use it to initialize some things when using "Add new" (translation)
306
  if (isset($_GET['from_post']) && isset($_GET['new_lang'])) {
330
  if (!isset($_POST['post_lang_choice']))
331
  return;
332
 
333
+ // save translations
 
334
  $this->save_translations('post', $post_id, $_POST['post_tr_lang']);
335
 
336
  // synchronise terms and metas in translations
359
  wp_set_object_terms($tr_id, $newterms, $tax); // replace terms in translation
360
  }
361
 
362
+ // synchronize metas and allow plugins to do the same
363
  $metas = apply_filters('pll_copy_metas', array('_wp_page_template', '_thumbnail_id'));
364
  foreach ($metas as $meta) {
365
+ if ($value = get_post_meta($post_id, $meta, true))
366
  update_post_meta($tr_id, $meta, get_post_meta($post_id, $meta, true));
367
  else
368
  delete_post_meta($tr_id, $meta);
371
  // post parent
372
  if ($parent_id = wp_get_post_parent_id($post_id));
373
  $post_parent = $this->get_translation('post', $parent_id, $lang);
374
+
375
  global $wpdb;
376
  $wpdb->update($wpdb->posts, array('post_parent'=> isset($post_parent) ? $post_parent : 0), array( 'ID' => $tr_id ));
377
  }
410
  return $clauses;
411
 
412
  global $post_ID;
 
413
 
414
  // ajax response for changing the language in the post metabox
415
  if (isset($_POST['lang']))
428
 
429
  // for a new post
430
  elseif ($screen->base == 'post' && !PLL_DISPLAY_ALL)
431
+ $lang = $this->get_language($this->options['default_lang']);
432
 
433
  // adds our clauses to filter by current language
434
  return isset($lang) ? $this->_terms_clauses($clauses, $lang) : $clauses;
440
 
441
  if (isset($_GET['new_lang']))
442
  $lang = $this->get_language($_GET['new_lang']);
443
+ else
444
+ $lang = $this->get_language($this->options['default_lang']);
 
 
445
 
446
  $listlanguages = $this->get_languages_list();
447
 
523
 
524
  // synchronize translations of this term in all posts
525
 
526
+ // get all posts associated to this term
527
  $posts = get_posts(array(
528
  'numberposts'=>-1,
529
  'post_type' => 'any',
541
  if ($translated_term = $this->get_term($term_id, $language)) {
542
  foreach ($posts as $post_id) {
543
  if ($translated_post = $this->get_post($post_id, $language))
544
+ wp_set_object_terms($translated_post, $translated_term, $taxonomy, true);
545
  }
546
  }
547
  }
include/admin.php CHANGED
@@ -61,7 +61,7 @@ class Polylang_Admin extends Polylang_Base {
61
  function languages_page() {
62
  global $wp_rewrite;
63
  $options = get_option('polylang');
64
- $listlanguages = $this->get_languages_list();
65
 
66
  // for nav menus form
67
  $locations = get_registered_nav_menus();
@@ -80,12 +80,14 @@ class Polylang_Admin extends Polylang_Base {
80
 
81
  if ($error == 0) {
82
  wp_insert_term($_POST['name'],'language',array('slug'=>$_POST['slug'], 'description'=>$_POST['description'], 'term_group'=>$_POST['term_group']));
83
- $wp_rewrite->flush_rules(); // refresh rewrite rules
84
 
85
  if (!isset($options['default_lang'])) { // if this is the first language created, set it as default language
86
  $options['default_lang'] = $_POST['slug'];
87
  update_option('polylang', $options);
88
  }
 
 
 
89
  if (!$this->download_mo($_POST['description']))
90
  $error = 5;
91
  }
@@ -133,15 +135,16 @@ class Polylang_Admin extends Polylang_Base {
133
 
134
  // delete the language itself
135
  wp_delete_term($lang_id, 'language');
136
- $wp_rewrite->flush_rules(); // refresh rewrite rules
137
 
138
  // oops ! we deleted the default language...
139
- if ($options['default_lang'] == $lang_slug) {
140
- if (!empty($listlanguages))
141
- $options['default_lang'] = reset($this->get_languages_list())->slug; // arbitrary choice...
142
  else
143
  unset($options['default_lang']);
144
  update_option('polylang', $options);
 
 
145
  }
146
  }
147
  wp_redirect('admin.php?page=mlang'); // to refresh the page (possible thanks to the $_GET['noheader']=true)
@@ -219,19 +222,31 @@ class Polylang_Admin extends Polylang_Base {
219
  case 'string-translation':
220
  check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
221
 
 
222
  $mo = new MO();
223
- foreach ($listlanguages as $language) {
 
224
  $reader = new POMO_StringReader(base64_decode(get_option('polylang_mo'.$language->term_id)));
225
  $mo->import_from_reader($reader);
226
 
227
- foreach ($_POST['string'] as $key=>$string) {
228
- $string = stripslashes($string);
229
- $mo->add_entry($mo->make_entry($string, stripslashes($_POST['translation'][$language->name][$key])));
230
  }
231
  // FIXME should I clean the mo object to remove unused strings ?
232
  // use base64_encode to store binary mo data in database text field
233
- update_option('polylang_mo'.$language->term_id, base64_encode($mo->export()));
 
 
 
 
 
 
 
234
  }
 
 
 
 
235
  break;
236
 
237
  case 'options':
@@ -267,14 +282,15 @@ class Polylang_Admin extends Polylang_Base {
267
  }
268
 
269
  // prepare the list of tabs
270
- $tabs = array(
271
- 'lang' => __('Languages','polylang'),
272
- 'menus' => __('Menus','polylang'),
273
- 'strings' => __('Strings translation','polylang'),
274
- 'settings' => __('Settings', 'polylang')
275
- );
276
- if (!current_theme_supports( 'menus' ))
277
- unset($tabs['menus']); // don't display the menu tab if the active theme does not support nav menus
 
278
 
279
  $active_tab = isset($_GET['tab']) && $_GET['tab'] ? $_GET['tab'] : 'lang';
280
 
@@ -313,32 +329,9 @@ class Polylang_Admin extends Polylang_Base {
313
  break;
314
 
315
  case 'strings':
316
- global $wp_registered_widgets;
317
-
318
- // WP strings
319
- $this->register_string(__('Site Title'), get_option('blogname'));
320
- $this->register_string(__('Tagline'), get_option('blogdescription'));
321
-
322
- // widgets titles
323
- $sidebars = wp_get_sidebars_widgets();
324
- foreach ($sidebars as $sidebar => $widgets) {
325
- if ($sidebar == 'wp_inactive_widgets')
326
- continue;
327
-
328
- foreach ($widgets as $widget) {
329
- if (!isset($wp_registered_widgets[$widget]))
330
- continue;
331
-
332
- $widget_settings = $wp_registered_widgets[$widget]['callback'][0]->get_settings();
333
- $number = $wp_registered_widgets[$widget]['params'][0]['number'];
334
- $title = $widget_settings[$number]['title'];
335
- if(isset($title) && $title)
336
- $this->register_string(__('Widget title'), $title);
337
- }
338
- }
339
 
340
- $data = &$this->strings;
341
-
342
  // load translations
343
  $mo = new MO();
344
  foreach ($listlanguages as $language) {
@@ -477,6 +470,36 @@ class Polylang_Admin extends Polylang_Base {
477
  foreach ($this->get_languages_list() as $language)
478
  $this->download_mo($language->description, $version);
479
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
480
 
481
  } // class Polylang_Admin
482
 
61
  function languages_page() {
62
  global $wp_rewrite;
63
  $options = get_option('polylang');
64
+ // $listlanguages = $this->get_languages_list();
65
 
66
  // for nav menus form
67
  $locations = get_registered_nav_menus();
80
 
81
  if ($error == 0) {
82
  wp_insert_term($_POST['name'],'language',array('slug'=>$_POST['slug'], 'description'=>$_POST['description'], 'term_group'=>$_POST['term_group']));
 
83
 
84
  if (!isset($options['default_lang'])) { // if this is the first language created, set it as default language
85
  $options['default_lang'] = $_POST['slug'];
86
  update_option('polylang', $options);
87
  }
88
+
89
+ $wp_rewrite->flush_rules(); // refresh rewrite rules
90
+
91
  if (!$this->download_mo($_POST['description']))
92
  $error = 5;
93
  }
135
 
136
  // delete the language itself
137
  wp_delete_term($lang_id, 'language');
 
138
 
139
  // oops ! we deleted the default language...
140
+ if ($options['default_lang'] == $lang_slug) {
141
+ if ($listlanguages = $this->get_languages_list())
142
+ $options['default_lang'] = $listlanguages[0]->slug; // arbitrary choice...
143
  else
144
  unset($options['default_lang']);
145
  update_option('polylang', $options);
146
+
147
+ $wp_rewrite->flush_rules(); // refresh rewrite rules
148
  }
149
  }
150
  wp_redirect('admin.php?page=mlang'); // to refresh the page (possible thanks to the $_GET['noheader']=true)
222
  case 'string-translation':
223
  check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
224
 
225
+ $strings = $this->get_strings();
226
  $mo = new MO();
227
+
228
+ foreach ($this->get_languages_list() as $language) {
229
  $reader = new POMO_StringReader(base64_decode(get_option('polylang_mo'.$language->term_id)));
230
  $mo->import_from_reader($reader);
231
 
232
+ foreach ($_POST['translation'][$language->name] as $key=>$translation) {
233
+ $mo->add_entry($mo->make_entry($strings[$key]['string'], stripslashes($translation)));
 
234
  }
235
  // FIXME should I clean the mo object to remove unused strings ?
236
  // use base64_encode to store binary mo data in database text field
237
+ global $wp_version;
238
+ if (version_compare($wp_version, '3.3', '<')) {
239
+ // backward compatibility for WP < 3.3
240
+ require_once(PLL_INC . '/mo.php');
241
+ update_option('polylang_mo'.$language->term_id, base64_encode(pll_mo_export($mo)));
242
+ }
243
+ else
244
+ update_option('polylang_mo'.$language->term_id, base64_encode($mo->export())); // MO::export since WP 3.3
245
  }
246
+
247
+ $paged = isset($_GET['paged']) ? '&paged='.$_GET['paged'] : '';
248
+ wp_redirect('admin.php?page=mlang&tab=strings'.$paged); // to refresh the page (possible thanks to the $_GET['noheader']=true)
249
+ exit;
250
  break;
251
 
252
  case 'options':
282
  }
283
 
284
  // prepare the list of tabs
285
+ $tabs = array('lang' => __('Languages','polylang'));
286
+
287
+ // only if at least one language has been created
288
+ if ($listlanguages = $this->get_languages_list()) {
289
+ if (current_theme_supports('menus'))
290
+ $tabs['menus'] = __('Menus','polylang'); // don't display the menu tab if the active theme does not support nav menus
291
+
292
+ $tabs += array('strings' => __('Strings translation','polylang'), 'settings' => __('Settings', 'polylang'));
293
+ }
294
 
295
  $active_tab = isset($_GET['tab']) && $_GET['tab'] ? $_GET['tab'] : 'lang';
296
 
329
  break;
330
 
331
  case 'strings':
332
+ // get the strings to translate
333
+ $data = $this->get_strings();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
 
 
335
  // load translations
336
  $mo = new MO();
337
  foreach ($listlanguages as $language) {
470
  foreach ($this->get_languages_list() as $language)
471
  $this->download_mo($language->description, $version);
472
  }
473
+
474
+ function &get_strings() {
475
+ global $wp_registered_widgets;
476
+
477
+ // WP strings
478
+ $this->register_string(__('Site Title'), get_option('blogname'));
479
+ $this->register_string(__('Tagline'), get_option('blogdescription'));
480
+
481
+ // widgets titles
482
+ $sidebars = wp_get_sidebars_widgets();
483
+ foreach ($sidebars as $sidebar => $widgets) {
484
+ if ($sidebar == 'wp_inactive_widgets')
485
+ continue;
486
+
487
+ foreach ($widgets as $widget) {
488
+ // nothing can be done if the widget is created using pre WP2.8 API :(
489
+ // there is no object, so we can't access it to get the widget options
490
+ // the second part of the test is probably useless
491
+ if (!isset($wp_registered_widgets[$widget]['callback'][0]) || !is_object($wp_registered_widgets[$widget]['callback'][0]))
492
+ continue;
493
+
494
+ $widget_settings = $wp_registered_widgets[$widget]['callback'][0]->get_settings();
495
+ $number = $wp_registered_widgets[$widget]['params'][0]['number'];
496
+ $title = $widget_settings[$number]['title'];
497
+ if(isset($title) && $title)
498
+ $this->register_string(__('Widget title'), $title);
499
+ }
500
+ }
501
+ return $this->strings;
502
+ }
503
 
504
  } // class Polylang_Admin
505
 
include/calendar.php CHANGED
@@ -11,13 +11,15 @@ if(!class_exists('WP_Widget_Calendar')){
11
  class Polylang_Widget_Calendar extends WP_Widget_Calendar {
12
 
13
  function widget( $args, $instance ) {
 
 
14
  extract($args);
15
  $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
16
  echo $before_widget;
17
  if ( $title )
18
  echo $before_title . $title . $after_title;
19
  echo '<div id="calendar_wrap">';
20
- $this->get_calendar(); #modified#
21
  echo '</div>';
22
  echo $after_widget;
23
  }
@@ -27,9 +29,6 @@ class Polylang_Widget_Calendar extends WP_Widget_Calendar {
27
  global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
28
  global $polylang; #added#
29
 
30
- if (!isset($polylang)) #added#
31
- return; #added#
32
-
33
  $lang = $polylang->get_current_language()->term_taxonomy_id; #added#
34
 
35
  $cache = array();
11
  class Polylang_Widget_Calendar extends WP_Widget_Calendar {
12
 
13
  function widget( $args, $instance ) {
14
+ global $polylang; #added#
15
+
16
  extract($args);
17
  $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title'], $instance, $this->id_base);
18
  echo $before_widget;
19
  if ( $title )
20
  echo $before_title . $title . $after_title;
21
  echo '<div id="calendar_wrap">';
22
+ isset($polylang) && $polylang->get_languages_list() ? $this->get_calendar() : get_calendar(); #modified#
23
  echo '</div>';
24
  echo $after_widget;
25
  }
29
  global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
30
  global $polylang; #added#
31
 
 
 
 
32
  $lang = $polylang->get_current_language()->term_taxonomy_id; #added#
33
 
34
  $cache = array();
include/core.php CHANGED
@@ -142,7 +142,7 @@ class Polylang_Core extends Polylang_base {
142
  }
143
  } // options['browser']
144
 
145
- // return default if there is no preferences in the browser or preferences does not match our languages or it is requested not to use the browser preference
146
  return isset($pref_lang) ? $pref_lang : $this->get_language($this->options['default_lang']);
147
  }
148
 
@@ -191,7 +191,7 @@ class Polylang_Core extends Polylang_base {
191
  // as done by xili_language and here: load text domains and reinitialize wp_locale with the action 'wp'
192
  // as done by qtranslate: define the locale with the action 'plugins_loaded', but in this case, the language must be specified in the url.
193
  function load_textdomains() {
194
- // sets the current language
195
  if (!($this->curlang = $this->get_current_language()))
196
  return; // something went wrong
197
 
@@ -424,22 +424,26 @@ class Polylang_Core extends Polylang_base {
424
 
425
  // Modifies the feed link to add the language parameter
426
  function feed_link($url, $feed) {
427
- return $GLOBALS['wp_rewrite']->using_permalinks() ? $this->add_language_to_link($url) : esc_url(home_url('?lang='.$this->curlang->slug.'&feed='.$feed));
 
428
  }
429
 
430
  // modifies the sql request for wp_get_archives an get_adjacent_post to filter by the current language
431
  function posts_join($sql) {
432
- return $sql . $GLOBALS['wpdb']->prepare(" INNER JOIN $wpdb->term_relationships ON object_id = ID");
 
433
  }
434
 
435
  // modifies the sql request for wp_get_archives and get_adjacent_post to filter by the current language
436
  function posts_where($sql) {
437
- return $sql . $GLOBALS['wpdb']->prepare(" AND term_taxonomy_id = %d", $this->curlang->term_taxonomy_id);
 
438
  }
439
 
440
  // modifies the author and date links to add the language parameter
441
  function archive_link($link) {
442
- return $GLOBALS['wp_rewrite']->using_permalinks() ?
 
443
  $this->add_language_to_link($link) :
444
  esc_url(str_replace($this->home.'/?', $this->home.'/?lang='.$this->curlang->slug.'&amp;', $link));
445
  }
@@ -595,7 +599,7 @@ class Polylang_Core extends Polylang_base {
595
  return true;
596
  elseif ('page' == get_option('show_on_front') && $this->page_on_front && is_page($this->get_post($this->page_on_front, $this->get_current_language())))
597
  return true;
598
- elseif(is_tax('language'))
599
  return true;
600
  else
601
  return false;
@@ -658,7 +662,7 @@ class Polylang_Core extends Polylang_base {
658
  'show_names' => 1, // show language names
659
  'force_home' => 0, // tries to find a translation (available only if display != dropdown)
660
  'hide_if_no_translation' => 0, // don't hide the link if there is no translation
661
- 'hide_current' => 0, // don't hide current language
662
  );
663
  extract(wp_parse_args($args, $defaults));
664
 
@@ -680,7 +684,7 @@ class Polylang_Core extends Polylang_base {
680
 
681
  $url = $force_home ? null : $this->get_translation_url($language);
682
 
683
- // hide if no translation exists
684
  if (!isset($url) && $hide_if_no_translation)
685
  continue;
686
 
142
  }
143
  } // options['browser']
144
 
145
+ // return default if there is no preferences in the browser or preferences does not match our languages or it is requested not to use the browser preference
146
  return isset($pref_lang) ? $pref_lang : $this->get_language($this->options['default_lang']);
147
  }
148
 
191
  // as done by xili_language and here: load text domains and reinitialize wp_locale with the action 'wp'
192
  // as done by qtranslate: define the locale with the action 'plugins_loaded', but in this case, the language must be specified in the url.
193
  function load_textdomains() {
194
+ // sets the current language
195
  if (!($this->curlang = $this->get_current_language()))
196
  return; // something went wrong
197
 
424
 
425
  // Modifies the feed link to add the language parameter
426
  function feed_link($url, $feed) {
427
+ global $wp_rewrite;
428
+ return $wp_rewrite->using_permalinks() ? $this->add_language_to_link($url) : esc_url(home_url('?lang='.$this->curlang->slug.'&feed='.$feed));
429
  }
430
 
431
  // modifies the sql request for wp_get_archives an get_adjacent_post to filter by the current language
432
  function posts_join($sql) {
433
+ global $wpdb;
434
+ return $sql . $wpdb->prepare(" INNER JOIN $wpdb->term_relationships ON object_id = ID");
435
  }
436
 
437
  // modifies the sql request for wp_get_archives and get_adjacent_post to filter by the current language
438
  function posts_where($sql) {
439
+ global $wpdb;
440
+ return $sql . $wpdb->prepare(" AND term_taxonomy_id = %d", $this->curlang->term_taxonomy_id);
441
  }
442
 
443
  // modifies the author and date links to add the language parameter
444
  function archive_link($link) {
445
+ global $wp_rewrite;
446
+ return $wp_rewrite->using_permalinks() ?
447
  $this->add_language_to_link($link) :
448
  esc_url(str_replace($this->home.'/?', $this->home.'/?lang='.$this->curlang->slug.'&amp;', $link));
449
  }
599
  return true;
600
  elseif ('page' == get_option('show_on_front') && $this->page_on_front && is_page($this->get_post($this->page_on_front, $this->get_current_language())))
601
  return true;
602
+ elseif(is_tax('language') && !is_archive())
603
  return true;
604
  else
605
  return false;
662
  'show_names' => 1, // show language names
663
  'force_home' => 0, // tries to find a translation (available only if display != dropdown)
664
  'hide_if_no_translation' => 0, // don't hide the link if there is no translation
665
+ 'hide_current' => 0, // don't hide current language
666
  );
667
  extract(wp_parse_args($args, $defaults));
668
 
684
 
685
  $url = $force_home ? null : $this->get_translation_url($language);
686
 
687
+ // hide if no translation exists
688
  if (!isset($url) && $hide_if_no_translation)
689
  continue;
690
 
include/languages-form.php CHANGED
@@ -144,7 +144,7 @@ break;
144
  case 'strings':
145
 
146
  $paged = isset($_GET['paged']) ? '&paged='.$_GET['paged'] : '';?>
147
- <form id="string-translation" method="post" action="<?php echo esc_url(admin_url('admin.php?page=mlang&tab=strings'.$paged))?>" class="validate">
148
  <?php wp_nonce_field('string-translation', '_wpnonce_string-translation');?>
149
  <input type="hidden" name="action" value="string-translation" /><?php
150
  $string_table->display();
144
  case 'strings':
145
 
146
  $paged = isset($_GET['paged']) ? '&paged='.$_GET['paged'] : '';?>
147
+ <form id="string-translation" method="post" action="<?php echo esc_url(admin_url('admin.php?page=mlang&tab=strings'.$paged.'&noheader=true'))?>" class="validate">
148
  <?php wp_nonce_field('string-translation', '_wpnonce_string-translation');?>
149
  <input type="hidden" name="action" value="string-translation" /><?php
150
  $string_table->display();
include/list-table.php CHANGED
@@ -112,8 +112,7 @@ class Polylang_String_Table extends WP_List_Table {
112
  }
113
 
114
  function column_translations($item){
115
- $out = sprintf('<input type="hidden" name="string[%1$s]" value="%2$s" />', esc_attr($item['row']), esc_html($item['string']));
116
-
117
  foreach($item['translations'] as $key=>$translation)
118
  $out .= sprintf('<div class="translation"><label for="%1$s-%2$s">%3$s</label><input name="translation[%1$s][%2$s]" id="%1$s-%2$s" value="%4$s" /></div>',
119
  esc_attr($key), esc_attr($item['row']), esc_html($key), esc_html($translation));
112
  }
113
 
114
  function column_translations($item){
115
+ $out = '';
 
116
  foreach($item['translations'] as $key=>$translation)
117
  $out .= sprintf('<div class="translation"><label for="%1$s-%2$s">%3$s</label><input name="translation[%1$s][%2$s]" id="%1$s-%2$s" value="%4$s" /></div>',
118
  esc_attr($key), esc_attr($item['row']), esc_html($key), esc_html($translation));
include/mo.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Backward compatibility for WP versions older than 3.3, in which the method MO::export does not exist
3
+ // FIXME to be removed once WP 3.2.1 and older versions is no more supported
4
+
5
+ function pll_mo_export($mo) {
6
+ $tmp_fh = fopen("php://temp", 'r+');
7
+ if ( !$tmp_fh ) return false;
8
+ pll_mo_export_to_file_handle( $mo, $tmp_fh );
9
+ rewind( $tmp_fh );
10
+ return stream_get_contents( $tmp_fh );
11
+ }
12
+
13
+ function pll_mo_export_to_file_handle($mo, $fh) {
14
+ $entries = array_filter($mo->entries, create_function('$e', 'return !empty($e->translations);'));
15
+ ksort($entries);
16
+ $magic = 0x950412de;
17
+ $revision = 0;
18
+ $total = count($entries) + 1; // all the headers are one entry
19
+ $originals_lenghts_addr = 28;
20
+ $translations_lenghts_addr = $originals_lenghts_addr + 8 * $total;
21
+ $size_of_hash = 0;
22
+ $hash_addr = $translations_lenghts_addr + 8 * $total;
23
+ $current_addr = $hash_addr;
24
+ fwrite($fh, pack('V*', $magic, $revision, $total, $originals_lenghts_addr,
25
+ $translations_lenghts_addr, $size_of_hash, $hash_addr));
26
+ fseek($fh, $originals_lenghts_addr);
27
+
28
+ // headers' msgid is an empty string
29
+ fwrite($fh, pack('VV', 0, $current_addr));
30
+ $current_addr++;
31
+ $originals_table = chr(0);
32
+
33
+ foreach($entries as $entry) {
34
+ $originals_table .= $mo->export_original($entry) . chr(0);
35
+ $length = strlen($mo->export_original($entry));
36
+ fwrite($fh, pack('VV', $length, $current_addr));
37
+ $current_addr += $length + 1; // account for the NULL byte after
38
+ }
39
+
40
+ $exported_headers = $mo->export_headers();
41
+ fwrite($fh, pack('VV', strlen($exported_headers), $current_addr));
42
+ $current_addr += strlen($exported_headers) + 1;
43
+ $translations_table = $exported_headers . chr(0);
44
+
45
+ foreach($entries as $entry) {
46
+ $translations_table .= $mo->export_translations($entry) . chr(0);
47
+ $length = strlen($mo->export_translations($entry));
48
+ fwrite($fh, pack('VV', $length, $current_addr));
49
+ $current_addr += $length + 1;
50
+ }
51
+
52
+ fwrite($fh, $originals_table);
53
+ fwrite($fh, $translations_table);
54
+ return true;
55
+ }
56
+ ?>
include/widget.php CHANGED
@@ -9,9 +9,7 @@ class Polylang_Widget extends WP_Widget {
9
  // displays the widget
10
  function widget($args, $instance) {
11
  global $polylang;
12
-
13
- // prevents the function to be called from admin side where $polylang is not defined
14
- if (!isset($polylang))
15
  return;
16
 
17
  extract($args);
9
  // displays the widget
10
  function widget($args, $instance) {
11
  global $polylang;
12
+ if (!(isset($polylang) && $polylang->get_languages_list()))
 
 
13
  return;
14
 
15
  extract($args);
languages/polylang-nl_NL.mo ADDED
Binary file
languages/polylang-nl_NL.po ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: polylang\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-01-03 20:07+0100\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: F. Demarle\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: \n"
14
+ "X-Poedit-Country: \n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: .\n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: ..\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #: polylang.php:179
23
+ #@ polylang
24
+ msgid "Error: Restore of local flags failed!"
25
+ msgstr "Fout: Herstel van lokale vlaggen mislukt!"
26
+
27
+ #: polylang.php:180
28
+ #, php-format
29
+ #@ polylang
30
+ msgid "Please move your local flags from %s to %s"
31
+ msgstr "Verplaats je lokale vlaggen van %s naar %s"
32
+
33
+ #: include/add-term-form.php:5
34
+ #: include/edit-term-form.php:6
35
+ #: include/list-table.php:12
36
+ #: include/post-translations.php:4
37
+ #: include/term-translations.php:15
38
+ #@ polylang
39
+ msgid "Language"
40
+ msgstr "Taal"
41
+
42
+ #: include/add-term-form.php:17
43
+ #: include/edit-term-form.php:19
44
+ #@ polylang
45
+ msgid "Sets the language"
46
+ msgstr "Stelt de taal in"
47
+
48
+ #: include/widget.php:6
49
+ #@ polylang
50
+ msgid "Language Switcher"
51
+ msgstr "Taalschakelaar"
52
+
53
+ #: include/widget.php:6
54
+ #@ polylang
55
+ msgid "Displays a language switcher"
56
+ msgstr "Toon een taalschakelaar"
57
+
58
+ #: include/widget.php:74
59
+ #@ polylang
60
+ msgid "Title:"
61
+ msgstr "Titel:"
62
+
63
+ #: include/admin.php:304
64
+ #: include/widget.php:77
65
+ #@ polylang
66
+ msgid "Displays language names"
67
+ msgstr "Toon namen van talen"
68
+
69
+ #: include/admin.php:305
70
+ #: include/widget.php:78
71
+ #@ polylang
72
+ msgid "Displays flags"
73
+ msgstr "Toon vlaggen"
74
+
75
+ #: include/widget.php:79
76
+ #@ polylang
77
+ msgid "Displays as dropdown"
78
+ msgstr "Toon als dropdown"
79
+
80
+ #: include/admin.php:306
81
+ #: include/widget.php:80
82
+ #@ polylang
83
+ msgid "Forces link to front page"
84
+ msgstr "Forceer link naar startpagina"
85
+
86
+ #: include/admin.php:25
87
+ #: include/admin.php:274
88
+ #@ default
89
+ #@ polylang
90
+ msgid "Settings"
91
+ msgstr "Instellingen"
92
+
93
+ #: include/admin-filters.php:164
94
+ #: include/admin.php:32
95
+ #: include/admin.php:271
96
+ #: include/list-table.php:13
97
+ #@ polylang
98
+ msgid "Languages"
99
+ msgstr "Talen"
100
+
101
+ #: include/admin.php:272
102
+ #@ polylang
103
+ msgid "Menus"
104
+ msgstr "Menu's"
105
+
106
+ #: include/admin.php:273
107
+ #: include/list-table.php:104
108
+ #@ polylang
109
+ msgid "Strings translation"
110
+ msgstr "Tekstvertaling"
111
+
112
+ #: include/admin.php:292
113
+ #@ polylang
114
+ msgid "Enter a valid WorPress locale"
115
+ msgstr "Voer een geldige Wordpress lokaal in"
116
+
117
+ #: include/admin.php:293
118
+ #@ polylang
119
+ msgid "The language code must be 2 characters long"
120
+ msgstr "De taalcode moet uit 2 karakters bestaan"
121
+
122
+ #: include/admin.php:294
123
+ #@ polylang
124
+ msgid "The language code must be unique"
125
+ msgstr "De taalcode moet uniek zijn"
126
+
127
+ #: include/admin.php:295
128
+ #@ polylang
129
+ msgid "The language must have a name"
130
+ msgstr "De taal moet een naam hebben"
131
+
132
+ #: include/admin.php:296
133
+ #@ polylang
134
+ msgid "The language was created, but the WordPress language file was not downloaded. Please install it manually."
135
+ msgstr "De taal was gecreëerd, maar het Wordpress taalbestand was niet gedownload. Handmatige installatie is noodzakelijk."
136
+
137
+ #: include/admin.php:303
138
+ #@ polylang
139
+ msgid "Displays a language switcher at the end of the menu"
140
+ msgstr "Toon een taalschakelaar aan het einde van het menu"
141
+
142
+ #: include/admin.php:319
143
+ #@ default
144
+ msgid "Site Title"
145
+ msgstr ""
146
+
147
+ #: include/admin.php:320
148
+ #@ default
149
+ msgid "Tagline"
150
+ msgstr ""
151
+
152
+ #: include/admin.php:336
153
+ #@ default
154
+ msgid "Widget title"
155
+ msgstr ""
156
+
157
+ #: include/post-metabox.php:5
158
+ #@ polylang
159
+ msgid "Page's language:"
160
+ msgstr "Taal van de pagina:"
161
+
162
+ #: include/post-metabox.php:5
163
+ #@ polylang
164
+ msgid "Post's language:"
165
+ msgstr "Taal van de post:"
166
+
167
+ #: include/list-table.php:128
168
+ #: include/term-translations.php:6
169
+ #: include/term-translations.php:11
170
+ #@ polylang
171
+ msgid "Translations"
172
+ msgstr "Vertalingen"
173
+
174
+ #: include/term-translations.php:16
175
+ #@ polylang
176
+ msgid "Translation"
177
+ msgstr "Vertaling"
178
+
179
+ #: include/list-table.php:26
180
+ #: include/post-translations.php:6
181
+ #: include/post-translations.php:27
182
+ #: include/term-translations.php:18
183
+ #: include/term-translations.php:65
184
+ #@ polylang
185
+ msgid "Edit"
186
+ msgstr "Wijzig"
187
+
188
+ #: include/term-translations.php:48
189
+ #@ polylang
190
+ msgid "No untranslated term"
191
+ msgstr "Geen onvertaalde term"
192
+
193
+ #: include/post-translations.php:32
194
+ #: include/term-translations.php:54
195
+ #@ polylang
196
+ msgid "Add new"
197
+ msgstr "Voeg nieuwe toe"
198
+
199
+ #: include/admin-filters.php:128
200
+ #: include/admin-filters.php:482
201
+ #@ polylang
202
+ msgid "Add new translation"
203
+ msgstr "Voeg nieuwe vertaling toe"
204
+
205
+ #: include/admin-filters.php:152
206
+ #@ polylang
207
+ msgid "Show all languages"
208
+ msgstr "Toon alle talen"
209
+
210
+ #: include/admin-filters.php:238
211
+ #@ default
212
+ msgid "(no parent)"
213
+ msgstr ""
214
+
215
+ #: include/admin-filters.php:577
216
+ #@ polylang
217
+ msgid "Theme locations and languages"
218
+ msgstr "Lokaties en talen van het thema"
219
+
220
+ #: include/admin-filters.php:582
221
+ #, php-format
222
+ #@ polylang
223
+ msgid "Please go to the %slanguages page%s to set theme locations and languages"
224
+ msgstr "Ga naar de %stalen pagina%s om lokaties en talen van het thema in te stellen"
225
+
226
+ #: include/admin-filters.php:593
227
+ #@ polylang
228
+ msgid "The widget is displayed for:"
229
+ msgstr "Het widget wordt getoond voor:"
230
+
231
+ #: include/admin-filters.php:594
232
+ #@ polylang
233
+ msgid "All languages"
234
+ msgstr "Alle talen"
235
+
236
+ #: include/list-table.php:27
237
+ #@ polylang
238
+ msgid "Delete"
239
+ msgstr "Verwijder"
240
+
241
+ #: include/languages-form.php:67
242
+ #: include/list-table.php:45
243
+ #@ polylang
244
+ msgid "Full name"
245
+ msgstr "Volledige naam"
246
+
247
+ #: include/languages-form.php:73
248
+ #: include/list-table.php:46
249
+ #@ polylang
250
+ msgid "Locale"
251
+ msgstr "Locale"
252
+
253
+ #: include/list-table.php:47
254
+ #@ polylang
255
+ msgid "Code"
256
+ msgstr "Taalcode"
257
+
258
+ #: include/languages-form.php:86
259
+ #: include/list-table.php:48
260
+ #@ polylang
261
+ msgid "Order"
262
+ msgstr "Volgorde"
263
+
264
+ #: include/list-table.php:49
265
+ #@ polylang
266
+ msgid "Flag"
267
+ msgstr "Vlag"
268
+
269
+ #: include/list-table.php:50
270
+ #@ polylang
271
+ msgid "Posts"
272
+ msgstr "Berichten"
273
+
274
+ #: include/list-table.php:105
275
+ #@ polylang
276
+ msgid "Strings translations"
277
+ msgstr "Tekstvertalingen"
278
+
279
+ #: include/list-table.php:126
280
+ #@ polylang
281
+ msgid "Name"
282
+ msgstr "Naam"
283
+
284
+ #: include/list-table.php:127
285
+ #@ polylang
286
+ msgid "String"
287
+ msgstr "Tekst"
288
+
289
+ #: include/calendar.php:133
290
+ #: include/calendar.php:141
291
+ #, php-format
292
+ #@ default
293
+ msgid "View posts for %1$s %2$s"
294
+ msgstr ""
295
+
296
+ #: include/languages-form.php:33
297
+ #@ polylang
298
+ msgid "Edit language"
299
+ msgstr "Wijzig taal"
300
+
301
+ #: include/languages-form.php:33
302
+ #: include/languages-form.php:91
303
+ #@ polylang
304
+ msgid "Add new language"
305
+ msgstr "Voeg nieuwe taal toe"
306
+
307
+ #: include/languages-form.php:55
308
+ #@ polylang
309
+ msgid "Choose a language"
310
+ msgstr "Kies een taal"
311
+
312
+ #: include/languages-form.php:63
313
+ #@ polylang
314
+ msgid "You can choose a language in the list or directly edit it below."
315
+ msgstr "Kies een taal uit de lijst of vul deze direct hieronder in."
316
+
317
+ #: include/languages-form.php:69
318
+ #@ polylang
319
+ msgid "The name is how it is displayed on your site (for example: English)."
320
+ msgstr "De naam geeft aan hoe het op je site getoond wordt (b.v.: Nederlands)."
321
+
322
+ #: include/languages-form.php:76
323
+ #@ polylang
324
+ msgid "Wordpress Locale for the language (for example: en_US). You will need to install the .mo file for this language."
325
+ msgstr "Wordpress Locale voor de taal (bv.: nl_NL). Installeer het .mo bestand voor deze taal."
326
+
327
+ #: include/languages-form.php:80
328
+ #@ polylang
329
+ msgid "Language code"
330
+ msgstr "Taalcode"
331
+
332
+ #: include/languages-form.php:82
333
+ #@ polylang
334
+ msgid "2-letters ISO 639-1 language code (for example: en)"
335
+ msgstr "2-karakter ISO 639-1 taalcode (bv.: nl)"
336
+
337
+ #: include/languages-form.php:88
338
+ #@ polylang
339
+ msgid "Position of the language in the language switcher"
340
+ msgstr "Positionering van de taal in de taalschakelaar"
341
+
342
+ #: include/languages-form.php:91
343
+ #@ default
344
+ msgid "Update"
345
+ msgstr ""
346
+
347
+ #: include/languages-form.php:127
348
+ #@ polylang
349
+ msgid "Language switcher"
350
+ msgstr "Taalschakelaar"
351
+
352
+ #: include/languages-form.php:166
353
+ #@ polylang
354
+ msgid "Default language"
355
+ msgstr "Standaardtaal"
356
+
357
+ #: include/languages-form.php:195
358
+ #@ polylang
359
+ msgid "There are posts, pages, categories or tags without language set. Do you want to set them all to default language ?"
360
+ msgstr "Er zijn berichten, pagina's, categorieën of tags zonder taalinstelling. Deze allemaal instellen op de standaardtaal?"
361
+
362
+ #: include/languages-form.php:203
363
+ #@ polylang
364
+ msgid "Detect browser language"
365
+ msgstr "Bepaal de taal van de browser"
366
+
367
+ #: include/languages-form.php:209
368
+ #@ polylang
369
+ msgid "When the front page is visited, set the language according to the browser preference"
370
+ msgstr "Wanneer de startpagina bezocht is, stel dan de taal in op basis van de voorkeur van de browser"
371
+
372
+ #: include/languages-form.php:216
373
+ #@ polylang
374
+ msgid "URL modifications"
375
+ msgstr "URL aanpassingen"
376
+
377
+ #: include/languages-form.php:222
378
+ #@ polylang
379
+ msgid "Keep /language/ in pretty permalinks. Example:"
380
+ msgstr "Behoud /taal/ in pretty permalinks. Voorbeeld:"
381
+
382
+ #: include/languages-form.php:230
383
+ #@ polylang
384
+ msgid "Remove /language/ in pretty permalinks. Example:"
385
+ msgstr "Verwijder /taal/ in pretty permalinks. Voorbeeld:"
386
+
387
+ #: include/languages-form.php:238
388
+ #@ polylang
389
+ msgid "Hide URL language information for default language"
390
+ msgstr "Verberg URL taalinformatie voor de standaardtaal"
391
+
392
+ #: include/post-translations.php:1
393
+ #@ polylang
394
+ msgid "ID of pages in other languages:"
395
+ msgstr "ID's van pagina's in andere talen:"
396
+
397
+ #: include/post-translations.php:1
398
+ #@ polylang
399
+ msgid "ID of posts in other languages:"
400
+ msgstr "ID's van berichten in andere talen:"
401
+
402
+ #: include/post-translations.php:5
403
+ #@ polylang
404
+ msgid "Page ID"
405
+ msgstr "Pagina ID"
406
+
407
+ #: include/post-translations.php:5
408
+ #@ polylang
409
+ msgid "Post ID"
410
+ msgstr "Bericht ID"
411
+
412
+ #: include/personal-options.php:5
413
+ #@ polylang
414
+ msgid "Admin language"
415
+ msgstr "Admin taal"
416
+
417
+ #: include/admin.php:476
418
+ #@ polylang
419
+ msgid "Upgrading language files&#8230;"
420
+ msgstr "Aanpassen taalbestanden&#8230;"
421
+
422
+ #. translators: Calendar caption: 1: month name, 2: 4-digit year
423
+ #: include/calendar.php:107
424
+ #, php-format
425
+ #@ default
426
+ msgctxt "calendar caption"
427
+ msgid "%1$s %2$s"
428
+ msgstr ""
429
+
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
6
  Author: F. Demarle
7
  Description: Adds multilingual capability to Wordpress
8
  */
@@ -23,7 +23,7 @@ Description: Adds multilingual capability to Wordpress
23
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
  */
25
 
26
- define('POLYLANG_VERSION', '0.6');
27
 
28
  define('POLYLANG_DIR', dirname(__FILE__)); // our directory
29
  define('PLL_INC', POLYLANG_DIR.'/include');
@@ -281,7 +281,9 @@ class Polylang extends Polylang_Base {
281
  $options = get_option('polylang');
282
  $newrules = array();
283
 
284
- $listlanguages = $this->get_languages_list();
 
 
285
 
286
  // modifies the rules created by WordPress when '/language/' is removed in permalinks
287
  if ($options['rewrite']) {
2
  /*
3
  Plugin Name: Polylang
4
  Plugin URI: http://wordpress.org/extend/plugins/polylang/
5
+ Version: 0.6.1
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.6.1');
27
 
28
  define('POLYLANG_DIR', dirname(__FILE__)); // our directory
29
  define('PLL_INC', POLYLANG_DIR.'/include');
281
  $options = get_option('polylang');
282
  $newrules = array();
283
 
284
+ // don't modify the rules if there is no languages created
285
+ if (!($listlanguages = $this->get_languages_list()))
286
+ return $rules;
287
 
288
  // modifies the rules created by WordPress when '/language/' is removed in permalinks
289
  if ($options['rewrite']) {
readme.txt CHANGED
@@ -4,15 +4,19 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: bilingual, language, i18n, international, l10n, localization, multilingual, multisite, translate, translation, widget
5
  Requires at least: 3.1
6
  Tested up to: 3.3.1
7
- Stable tag: 0.6
8
 
9
  Polylang adds multilingual content management support to WordPress.
10
 
11
  == Description ==
12
 
 
 
 
 
13
  = Upgrade Notice =
14
 
15
- Your custom flags in 'wp-content/plugins/polylang/local_flags' directory should move to 'wp-content/polylang'. People using the function 'pll_the_language' should be aware that it does not display the 'ul' tag anymore. I wrote about the reasons for these changes in the [forum](http://wordpress.org/support/topic/development-of-polylang-version-06).
16
 
17
  = Features =
18
 
@@ -40,12 +44,14 @@ The plugin admin interface is currently available in:
40
  * German contributed by [Christian Ries](http://www.singbyfoot.lu)
41
  * Russian contributed by [yoyurec](http://yoyurec.in.ua)
42
  * Greek contributed by [theodotos](http://www.ubuntucy.org)
 
43
 
44
  Other translators are welcome !
45
 
46
  = Notes =
47
 
48
  * The tests have been made with WordPress 3.3.1.
 
49
  * Your server must run PHP5
50
  * You must deactivate other multilingual plugins before activating Polylang, otherwise, you may get unexpected results !
51
  * 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...).
@@ -56,7 +62,7 @@ Don't hesitate to [give your feedback](http://wordpress.org/tags/polylang?forum_
56
 
57
  == Upgrade Notice ==
58
 
59
- Your custom flags in 'wp-content/plugins/polylang/local_flags' directory shhould move to 'wp-content/polylang'. People using the function 'pll_the_language' should be aware that it does not display the ul tag anymore.
60
 
61
  == Installation ==
62
 
@@ -82,7 +88,7 @@ In comparison to these plugins, Polylang tries to keep things simple and light,
82
 
83
  = Where to find help ? =
84
 
85
- * Read the [documentation](http://plugins.svn.wordpress.org/polylang/trunk/doc/documentation-en.pdf) supplied whith the plugin (in the doc directory) and search the [support forum](http://wordpress.org/tags/polylang?forum_id=10) first. You will most probably find your answer here.
86
  * If you still have a problem, open a new thread in the [support forum](http://wordpress.org/tags/polylang?forum_id=10).
87
 
88
  = Is Polylang compatible with multisite ? =
@@ -91,7 +97,7 @@ Yes. Since v0.5
91
 
92
  = Can I use my own flags for the language switcher ? =
93
 
94
- Yes. You have to use PNG or JPG files and name them with the WordPress locale. For example, en_US.png. Then upload these files in the `wp-content/polylang` directory. Don't use the `/polylang/flags` directory as your files would be removed when updating the plugin.
95
 
96
  == Screenshots ==
97
 
@@ -99,6 +105,18 @@ Yes. You have to use PNG or JPG files and name them with the WordPress locale. F
99
 
100
  == Changelog ==
101
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  = 0.6 (2012-01-07) =
103
 
104
  * Add Greek translation contributed by [theodotos](http://www.ubuntucy.org)
@@ -117,11 +135,11 @@ Yes. You have to use PNG or JPG files and name them with the WordPress locale. F
117
  = 0.5.1 (2011-12-18) =
118
 
119
  * Improved German translation contributed by [Christian Ries](http://www.singbyfoot.lu)
120
- * Bug correction: Translated homepage not recognized as home page when it displays posts
121
- * Bug correction: Predefined language list does not work on IE8
122
- * Bug correction: On some installations, "Add New" post doesn't keep intended language
123
- * Bug correction: Fatal error when Polylang is used together with the plugin Tabbed Widgets
124
- * Bug correction: Language Switcher points sometimes to wrong places
125
 
126
  = 0.5 (2011-12-07) =
127
 
@@ -135,11 +153,11 @@ Yes. You have to use PNG or JPG files and name them with the WordPress locale. F
135
  * Optimized the calendar widget (less code and sql queries executed)
136
  * Added the possibility to display posts and terms with no language set (see the documentation to know how to enable this functionnality)
137
  * Started the creation of a small API for theme and plugin programmers
138
- * Bug correction: When using a static front page, the page for posts does not work when using the default permalink settings
139
- * Bug correction: The search form does not work if a static front page is used
140
- * Bug correction: Quick edit breaks translations
141
- * Bug correction: Categories and post tags translations don't work for more than 2 languages
142
- * Bug correction: The output of wp_page_menu is not correct for non default languages
143
 
144
  = 0.4.4 (2011-11-28) =
145
 
@@ -149,10 +167,10 @@ Yes. You have to use PNG or JPG files and name them with the WordPress locale. F
149
  = 0.4.3 (2011-11-19) =
150
 
151
  * Add Russian translation contributed by [yoyurec](http://yoyurec.in.ua)
152
- * Bug correction: Impossible to suppress the language name in the language switcher widget settings
153
- * Bug correction: Post's page does not work when using a static front page
154
- * Bug correction: Flags in local_flags directory are removed after an automatic upgrade (now works for an upgrade from 0.4.3+ to a higher version)
155
- * Bug correction: Switching to default language displays a 404 Error when hiding the default language in url and displaying the language switcher as dropdown
156
  * Other minor bug corrections
157
  * Tests done with WordPress 3.3 beta 3
158
 
@@ -179,7 +197,7 @@ Yes. You have to use PNG or JPG files and name them with the WordPress locale. F
179
  * Add support for calendar widget
180
  * Improve performance: less sql queries
181
  * Improve data validation when creating or updating languages
182
- * Bug correction: 'wp_list_pages' page order is ignored when plugin is enabled
183
  * Bug correction: when using 'edit' or 'add new' (translation) for posts, the categories appear in the wrong language
184
  * Bug correction: pages are not included in language post count
185
  * Bug correction: the language switcher does not display languages if there are only pages
4
  Tags: bilingual, language, i18n, international, l10n, localization, multilingual, multisite, translate, translation, widget
5
  Requires at least: 3.1
6
  Tested up to: 3.3.1
7
+ Stable tag: 0.6.1
8
 
9
  Polylang adds multilingual content management support to WordPress.
10
 
11
  == Description ==
12
 
13
+ = Announcement =
14
+
15
+ [A development version of Polylang 0.7 is available](http://wordpress.org/support/topic/development-of-polylang-version-07).
16
+
17
  = Upgrade Notice =
18
 
19
+ When upgrading from 0.5.1 or older, your custom flags in 'wp-content/plugins/polylang/local_flags' directory should move to 'wp-content/polylang'. People using the function 'pll_the_language' should be aware that it does not display the 'ul' tag anymore. I wrote about the reasons for these changes in the [forum](http://wordpress.org/support/topic/development-of-polylang-version-06).
20
 
21
  = Features =
22
 
44
  * German contributed by [Christian Ries](http://www.singbyfoot.lu)
45
  * Russian contributed by [yoyurec](http://yoyurec.in.ua)
46
  * Greek contributed by [theodotos](http://www.ubuntucy.org)
47
+ * Dutch contributed by [AlbertGn](http://wordpress.org/support/profile/albertgn)
48
 
49
  Other translators are welcome !
50
 
51
  = Notes =
52
 
53
  * The tests have been made with WordPress 3.3.1.
54
+ * User strings (site title, widget titles) translation is active in WP 3.3 and newer only.
55
  * Your server must run PHP5
56
  * You must deactivate other multilingual plugins before activating Polylang, otherwise, you may get unexpected results !
57
  * 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...).
62
 
63
  == Upgrade Notice ==
64
 
65
+ When upgrading from 0.5.1 or older, your custom flags in 'wp-content/plugins/polylang/local_flags' directory should move to 'wp-content/polylang'. People using the function 'pll_the_language' should be aware that it does not display the ul tag anymore.
66
 
67
  == Installation ==
68
 
88
 
89
  = Where to find help ? =
90
 
91
+ * Read the [documentation](http://plugins.svn.wordpress.org/polylang/trunk/doc/documentation-en.pdf) supplied whith the plugin (in the doc directory) and search the [support forum](http://wordpress.org/tags/polylang?forum_id=10) first. I know that searching in the WordPress forum is not very convenient, but please give it a try. You can use generic search engines such as Google too as the WordPress forum SEO is very good. You will most probably find your answer here.
92
  * If you still have a problem, open a new thread in the [support forum](http://wordpress.org/tags/polylang?forum_id=10).
93
 
94
  = Is Polylang compatible with multisite ? =
97
 
98
  = Can I use my own flags for the language switcher ? =
99
 
100
+ Yes. You have to use PNG or JPG files and name them with the WordPress locale corresponding to the language. For example, en_US.png for English. Then upload these files in the `wp-content/polylang` directory. Don't use the `/polylang/flags` directory as your files would be removed when updating the plugin.
101
 
102
  == Screenshots ==
103
 
105
 
106
  == Changelog ==
107
 
108
+ = 0.6.1 =
109
+
110
+ * Add Dutch translation contributed by [AlbertGn](http://wordpress.org/support/profile/albertgn)
111
+ * Disable everything except the languages management panel while no language has been created
112
+ * Bug correction: can't have the same featured image in translated posts
113
+ * Bug correction: parent page dropdown does appear only after the page has been saved
114
+ * Bug correction: archives widget not working anymore
115
+ * Bug correction: string translations does not work for WP < 3.3
116
+ * Bug correction: fix fatal error in string translations caused by widgets using the old API
117
+ * Bug correction: the strings translation panel is unable to translate strings with special characters
118
+ * Bug correction: Polylang "is_front_page" returns true on archives pages
119
+
120
  = 0.6 (2012-01-07) =
121
 
122
  * Add Greek translation contributed by [theodotos](http://www.ubuntucy.org)
135
  = 0.5.1 (2011-12-18) =
136
 
137
  * Improved German translation contributed by [Christian Ries](http://www.singbyfoot.lu)
138
+ * Bug correction: translated homepage not recognized as home page when it displays posts
139
+ * Bug correction: predefined language list does not work on IE8
140
+ * Bug correction: on some installations, "Add New" post doesn't keep intended language
141
+ * Bug correction: fatal error when Polylang is used together with the plugin Tabbed Widgets
142
+ * Bug correction: language Switcher points sometimes to wrong places
143
 
144
  = 0.5 (2011-12-07) =
145
 
153
  * Optimized the calendar widget (less code and sql queries executed)
154
  * Added the possibility to display posts and terms with no language set (see the documentation to know how to enable this functionnality)
155
  * Started the creation of a small API for theme and plugin programmers
156
+ * Bug correction: when using a static front page, the page for posts does not work when using the default permalink settings
157
+ * Bug correction: the search form does not work if a static front page is used
158
+ * Bug correction: quick edit breaks translations
159
+ * Bug correction: categories and post tags translations don't work for more than 2 languages
160
+ * Bug correction: the output of wp_page_menu is not correct for non default languages
161
 
162
  = 0.4.4 (2011-11-28) =
163
 
167
  = 0.4.3 (2011-11-19) =
168
 
169
  * Add Russian translation contributed by [yoyurec](http://yoyurec.in.ua)
170
+ * Bug correction: impossible to suppress the language name in the language switcher widget settings
171
+ * Bug correction: post's page does not work when using a static front page
172
+ * Bug correction: flags in local_flags directory are removed after an automatic upgrade (now works for an upgrade from 0.4.3+ to a higher version)
173
+ * Bug correction: switching to default language displays a 404 Error when hiding the default language in url and displaying the language switcher as dropdown
174
  * Other minor bug corrections
175
  * Tests done with WordPress 3.3 beta 3
176
 
197
  * Add support for calendar widget
198
  * Improve performance: less sql queries
199
  * Improve data validation when creating or updating languages
200
+ * Bug correction: 'wp_list_pages' page order is ignored when the plugin is enabled
201
  * Bug correction: when using 'edit' or 'add new' (translation) for posts, the categories appear in the wrong language
202
  * Bug correction: pages are not included in language post count
203
  * Bug correction: the language switcher does not display languages if there are only pages