Version Description
(2013-05-20) =
- Move nav menu language switcher split from 'wp_nav_menu_objects' to 'wp_get_nav_menu_items' filter
- Add the filter 'pll_redirect_home'
- Automatically translate ids in 'include' argument of 'get_terms' (useful for the menus in the Suffusion theme)
- Add compatibility with Jetpack infinite scroll
- Bug correction: rtl text direction not set when adding the language code to all urls (introduced in 1.1)
- Bug correction: hide again navigation panel in theme customizer as it still doesn't work
- Bug correction: is_home not set on translated page when searching an empty string
- Bug correction: fatal error when creating a post or term from frontend (introduced in 1.1)
- Bug correction: attachments may load a wrong language when media translation was enabled then disabled
- Bug correction: warning when querying posts before the action 'wp_loaded' has been fired (in auto-translate.php)
- Bug correction: potential issue if other plugins use the filter 'get_nav_menu'
- Bug correction: interference between language inline edit and search in admin list tables
- Bug correction: auto-translate breaks queries tax_query when the 'field' is set to 'id'
- Bug correction: search is not filtered by language for default permalinks (introduced in 1.1)
- Tests done with WP 3.6 beta 3 and Twenty thirteen
Download this release
Release Info
Developer | Chouby |
Plugin | Polylang |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.1 to 1.1.1
- include/admin-filters.php +9 -10
- include/auto-translate.php +40 -26
- include/core.php +34 -21
- include/nav-menu.php +85 -25
- include/plugins-compat.php +13 -1
- js/nav-menu.js +1 -1
- js/nav-menu.min.js +1 -1
- js/post.js +8 -11
- js/post.min.js +1 -1
- js/term.js +4 -4
- js/term.min.js +1 -1
- languages/polylang-nb_NO.mo +0 -0
- languages/polylang-nb_NO.po +108 -93
- polylang.php +4 -4
- readme.txt +20 -2
include/admin-filters.php
CHANGED
@@ -72,7 +72,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
72 |
add_filter('wp_delete_file', array(&$this, 'wp_delete_file'));
|
73 |
|
74 |
// creates a media translation
|
75 |
-
if (isset($_GET['action']
|
76 |
$this->translate_media();
|
77 |
}
|
78 |
|
@@ -165,7 +165,8 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
165 |
|
166 |
// hidden field containing the post language for quick edit
|
167 |
if ($column == $this->get_first_language_column())
|
168 |
-
printf('<
|
|
|
169 |
|
170 |
// link to edit post (or a translation)
|
171 |
if ($id = ($inline && $lang->slug != $_POST['old_lang']) ? ($language->slug == $lang->slug ? $post_id : 0) : $this->get_post($post_id, $language))
|
@@ -219,8 +220,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
219 |
|
220 |
// do not filter post types such as nav_menu_item
|
221 |
if (isset($qvars['post_type']) && !in_array($qvars['post_type'], $this->post_types)) {
|
222 |
-
|
223 |
-
unset ($qvars['lang']);
|
224 |
return;
|
225 |
}
|
226 |
|
@@ -393,8 +393,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
393 |
|
394 |
// translate post parent if exists when using "Add new" (translation)
|
395 |
function wp_insert_post_parent($post_parent) {
|
396 |
-
return isset($_GET['from_post']
|
397 |
-
($parent = $this->get_translation('post', $id, $_GET['new_lang'])) ? $parent : $post_parent;
|
398 |
}
|
399 |
|
400 |
// copy page template, menu order, comment and ping status when using "Add new" (translation)
|
@@ -402,7 +401,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
402 |
// copy the meta '_wp_page_template' in save_post is not sufficient (the dropdown list in the metabox is not updated)
|
403 |
// We need to set $post->page_template (and so need to wait for the availability of $post)
|
404 |
function dbx_post_advanced() {
|
405 |
-
if (isset($_GET['from_post']
|
406 |
global $post;
|
407 |
$post->page_template = get_post_meta($_GET['from_post'], '_wp_page_template', true);
|
408 |
|
@@ -517,7 +516,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
517 |
|
518 |
// the hook is called when the post is created
|
519 |
// let's use it translate terms and copy metas when using "Add new" (translation)
|
520 |
-
if (isset($_GET['from_post']
|
521 |
$this->copy_post_metas($_GET['from_post'], $post_id, $_GET['new_lang']);
|
522 |
|
523 |
if (!isset($_POST['post_lang_choice']))
|
@@ -864,7 +863,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
864 |
$language = $this->get_language(substr($column, 9));
|
865 |
|
866 |
if ($column == $this->get_first_language_column())
|
867 |
-
printf('<
|
868 |
|
869 |
// link to edit term (or a translation)
|
870 |
if ($id = ($inline && $lang->slug != $_POST['old_lang']) ? ($language->slug == $lang->slug ? $term_id : 0) : $this->get_term($term_id, $language))
|
@@ -884,7 +883,7 @@ class Polylang_Admin_Filters extends Polylang_Admin_Base {
|
|
884 |
|
885 |
// translate term parent if exists when using "Add new" (translation)
|
886 |
function wp_dropdown_cats($output) {
|
887 |
-
if (isset($_GET['taxonomy']
|
888 |
if ($parent = $this->get_translation('term', $id, $_GET['new_lang']))
|
889 |
return str_replace('"'.$parent.'"', '"'.$parent.'" selected="selected"', $output);
|
890 |
}
|
72 |
add_filter('wp_delete_file', array(&$this, 'wp_delete_file'));
|
73 |
|
74 |
// creates a media translation
|
75 |
+
if (isset($_GET['action'], $_GET['new_lang'], $_GET['from_media']) && $_GET['action'] == 'translate_media')
|
76 |
$this->translate_media();
|
77 |
}
|
78 |
|
165 |
|
166 |
// hidden field containing the post language for quick edit
|
167 |
if ($column == $this->get_first_language_column())
|
168 |
+
printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($post_id), esc_html($lang->slug));
|
169 |
+
|
170 |
|
171 |
// link to edit post (or a translation)
|
172 |
if ($id = ($inline && $lang->slug != $_POST['old_lang']) ? ($language->slug == $lang->slug ? $post_id : 0) : $this->get_post($post_id, $language))
|
220 |
|
221 |
// do not filter post types such as nav_menu_item
|
222 |
if (isset($qvars['post_type']) && !in_array($qvars['post_type'], $this->post_types)) {
|
223 |
+
unset ($qvars['lang']);
|
|
|
224 |
return;
|
225 |
}
|
226 |
|
393 |
|
394 |
// translate post parent if exists when using "Add new" (translation)
|
395 |
function wp_insert_post_parent($post_parent) {
|
396 |
+
return isset($_GET['from_post'], $_GET['new_lang']) && ($id = wp_get_post_parent_id($_GET['from_post'])) && ($parent = $this->get_translation('post', $id, $_GET['new_lang'])) ? $parent : $post_parent;
|
|
|
397 |
}
|
398 |
|
399 |
// copy page template, menu order, comment and ping status when using "Add new" (translation)
|
401 |
// copy the meta '_wp_page_template' in save_post is not sufficient (the dropdown list in the metabox is not updated)
|
402 |
// We need to set $post->page_template (and so need to wait for the availability of $post)
|
403 |
function dbx_post_advanced() {
|
404 |
+
if (isset($_GET['from_post'], $_GET['new_lang'])) {
|
405 |
global $post;
|
406 |
$post->page_template = get_post_meta($_GET['from_post'], '_wp_page_template', true);
|
407 |
|
516 |
|
517 |
// the hook is called when the post is created
|
518 |
// let's use it translate terms and copy metas when using "Add new" (translation)
|
519 |
+
if (isset($_GET['from_post'], $_GET['new_lang']))
|
520 |
$this->copy_post_metas($_GET['from_post'], $post_id, $_GET['new_lang']);
|
521 |
|
522 |
if (!isset($_POST['post_lang_choice']))
|
863 |
$language = $this->get_language(substr($column, 9));
|
864 |
|
865 |
if ($column == $this->get_first_language_column())
|
866 |
+
printf('<div class="hidden" id="lang_%d">%s</div>', esc_attr($term_id), esc_html($lang->slug));
|
867 |
|
868 |
// link to edit term (or a translation)
|
869 |
if ($id = ($inline && $lang->slug != $_POST['old_lang']) ? ($language->slug == $lang->slug ? $term_id : 0) : $this->get_term($term_id, $language))
|
883 |
|
884 |
// translate term parent if exists when using "Add new" (translation)
|
885 |
function wp_dropdown_cats($output) {
|
886 |
+
if (isset($_GET['taxonomy'], $_GET['from_tag'], $_GET['new_lang']) && $id = get_term($_GET['from_tag'], $_GET['taxonomy'])->parent) {
|
887 |
if ($parent = $this->get_translation('term', $id, $_GET['new_lang']))
|
888 |
return str_replace('"'.$parent.'"', '"'.$parent.'" selected="selected"', $output);
|
889 |
}
|
include/auto-translate.php
CHANGED
@@ -6,12 +6,10 @@
|
|
6 |
class Polylang_Auto_Translate {
|
7 |
function __construct() {
|
8 |
add_action('pre_get_posts', array(&$this, 'pre_get_posts')); // after Polylang
|
|
|
9 |
}
|
10 |
|
11 |
function pre_get_posts($query) {
|
12 |
-
if (!$lang = pll_current_language())
|
13 |
-
return;
|
14 |
-
|
15 |
global $wpdb, $polylang;
|
16 |
$qv = &$query->query_vars;
|
17 |
|
@@ -77,31 +75,35 @@ class Polylang_Auto_Translate {
|
|
77 |
}
|
78 |
}
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
$
|
84 |
-
|
85 |
-
if (!empty($qv[$tax->query_var])) {
|
86 |
-
$sep = strpos($qv[$tax->query_var], ',') !== false ? ',' : '+'; // two possible separators
|
87 |
-
foreach (explode($sep, $qv[$tax->query_var]) as $slug)
|
88 |
-
$arr[] = (($tag = get_term_by('slug', $slug, $taxonomy)) && ($tr_id = pll_get_term($tag->term_id)) && !is_wp_error($tr = get_term($tr_id, $taxonomy))) ?
|
89 |
-
$tr->slug : $slug;
|
90 |
-
|
91 |
-
$qv[$tax->query_var] = implode($sep, $arr);
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
// tax_query since WP 3.1
|
96 |
-
if (!empty($qv['tax_query']) && is_array($qv['tax_query'])) {
|
97 |
-
foreach ($qv['tax_query'] as $key => $q) {
|
98 |
$arr = array();
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
$tr
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
}
|
106 |
}
|
107 |
|
@@ -131,6 +133,18 @@ class Polylang_Auto_Translate {
|
|
131 |
}
|
132 |
}
|
133 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
|
136 |
add_action('pll_language_defined', create_function('', 'new Polylang_Auto_Translate();'));
|
6 |
class Polylang_Auto_Translate {
|
7 |
function __construct() {
|
8 |
add_action('pre_get_posts', array(&$this, 'pre_get_posts')); // after Polylang
|
9 |
+
add_filter('get_terms_args', array(&$this, 'get_terms_args'), 10, 2);
|
10 |
}
|
11 |
|
12 |
function pre_get_posts($query) {
|
|
|
|
|
|
|
13 |
global $wpdb, $polylang;
|
14 |
$qv = &$query->query_vars;
|
15 |
|
75 |
}
|
76 |
}
|
77 |
|
78 |
+
if (isset($polylang->taxonomies) && is_array($polylang->taxonomies)) {
|
79 |
+
// custom taxonomies
|
80 |
+
// according to codex, this type of query is deprecated as of WP 3.1 but it does not appear in WP 3.5 source code
|
81 |
+
foreach (array_diff($polylang->taxonomies, array('category', 'post_tag')) as $taxonomy) {
|
82 |
+
$tax = get_taxonomy($taxonomy);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
$arr = array();
|
84 |
+
if (!empty($qv[$tax->query_var])) {
|
85 |
+
$sep = strpos($qv[$tax->query_var], ',') !== false ? ',' : '+'; // two possible separators
|
86 |
+
foreach (explode($sep, $qv[$tax->query_var]) as $slug)
|
87 |
+
$arr[] = (($tag = get_term_by('slug', $slug, $taxonomy)) && ($tr_id = pll_get_term($tag->term_id)) && !is_wp_error($tr = get_term($tr_id, $taxonomy))) ?
|
88 |
+
$tr->slug : $slug;
|
89 |
+
|
90 |
+
$qv[$tax->query_var] = implode($sep, $arr);
|
91 |
+
}
|
92 |
+
}
|
93 |
|
94 |
+
// tax_query since WP 3.1
|
95 |
+
if (!empty($qv['tax_query']) && is_array($qv['tax_query'])) {
|
96 |
+
foreach ($qv['tax_query'] as $key => $q) {
|
97 |
+
if (in_array($q['taxonomy'], $polylang->taxonomies)) {
|
98 |
+
$arr = array();
|
99 |
+
$field = isset($q['field']) && in_array($q['field'], array('slug', 'name')) ? $q['field'] : 'term_id';
|
100 |
+
foreach ( (array) $q['terms'] as $t)
|
101 |
+
$arr[] = (($tag = get_term_by($field, $t, $q['taxonomy'])) && ($tr_id = pll_get_term($tag->term_id)) && !is_wp_error($tr = get_term($tr_id, $q['taxonomy']))) ?
|
102 |
+
$tr->$field : $t;
|
103 |
+
|
104 |
+
$qv['tax_query'][$key]['terms'] = implode(',', $arr);
|
105 |
+
}
|
106 |
+
}
|
107 |
}
|
108 |
}
|
109 |
|
133 |
}
|
134 |
}
|
135 |
}
|
136 |
+
|
137 |
+
function get_terms_args($args, $taxonomies) {
|
138 |
+
global $polylang;
|
139 |
+
|
140 |
+
if (!empty($args['include']) && isset($polylang->taxonomies) && is_array($polylang->taxonomies) && array_intersect($taxonomies, $polylang->taxonomies)) {
|
141 |
+
foreach($args['include'] as $id)
|
142 |
+
$arr[] = ($tr = pll_get_term($id)) ? $tr : $id;
|
143 |
+
|
144 |
+
$args['include'] = $arr;
|
145 |
+
}
|
146 |
+
return $args;
|
147 |
+
}
|
148 |
}
|
149 |
|
150 |
add_action('pll_language_defined', create_function('', 'new Polylang_Auto_Translate();'));
|
include/core.php
CHANGED
@@ -200,7 +200,7 @@ class Polylang_Core extends Polylang_base {
|
|
200 |
return $this->curlang;
|
201 |
|
202 |
// no language set for 404
|
203 |
-
if (is_404() || current_filter() == 'login_init')
|
204 |
return $this->get_preferred_language();
|
205 |
|
206 |
if ($var = get_query_var('lang'))
|
@@ -292,6 +292,7 @@ class Polylang_Core extends Polylang_base {
|
|
292 |
add_action('wp', array(&$this, 'check_language_code_in_url')); // before Wordpress redirect_canonical
|
293 |
}
|
294 |
|
|
|
295 |
$GLOBALS['text_direction'] = get_metadata('term', $this->curlang->term_id, '_rtl', true) ? 'rtl' : 'ltr';
|
296 |
$GLOBALS['l10n']['pll_string'] = $this->mo_import($this->curlang);
|
297 |
do_action('pll_language_defined');
|
@@ -435,8 +436,11 @@ class Polylang_Core extends Polylang_base {
|
|
435 |
// don't redirect if $_POST is not empty as it could break other plugins
|
436 |
// don't forget the query string which may be added by plugins
|
437 |
elseif (is_string($redirect = $this->get_home_url($this->curlang)) && empty($_POST)) {
|
438 |
-
|
439 |
-
|
|
|
|
|
|
|
440 |
}
|
441 |
}
|
442 |
|
@@ -458,13 +462,13 @@ class Polylang_Core extends Polylang_base {
|
|
458 |
if (!$this->first_query && $this->curlang && !empty($qv['lang']))
|
459 |
return;
|
460 |
|
461 |
-
$is_post_type =
|
462 |
in_array($qv['post_type'], $this->post_types) ||
|
463 |
(is_array($qv['post_type']) && array_intersect($qv['post_type'], $this->post_types))
|
464 |
);
|
465 |
|
466 |
// don't filters post types not in our list
|
467 |
-
if (
|
468 |
return;
|
469 |
|
470 |
$this->first_query = false;
|
@@ -498,7 +502,8 @@ class Polylang_Core extends Polylang_base {
|
|
498 |
|
499 |
// sets is_home on translated home page when it displays posts
|
500 |
// is_home must be true on page 2, 3... too
|
501 |
-
|
|
|
502 |
$this->curlang = $this->get_language(get_query_var('lang')); // sets the language now otherwise it will be too late to filter sticky posts !
|
503 |
$query->is_home = true;
|
504 |
$query->is_archive = $query->is_tax = false;
|
@@ -526,7 +531,7 @@ class Polylang_Core extends Polylang_base {
|
|
526 |
$is_archive = (count($query->query) == 1 && !empty($qv['paged'])) ||
|
527 |
$query->is_date ||
|
528 |
$query->is_author ||
|
529 |
-
(
|
530 |
|
531 |
// sets 404 when the language is not set for archives needing the language in the url
|
532 |
if (!$this->options['hide_default'] && !isset($qv['lang']) && !$this->using_permalinks && $is_archive)
|
@@ -538,12 +543,12 @@ class Polylang_Core extends Polylang_base {
|
|
538 |
|
539 |
// allow filtering recent posts and secondary queries by the current language
|
540 |
// take care not to break queries for non visible post types such as nav_menu_items, attachments...
|
541 |
-
if (/*$query->is_home && */$this->curlang && (
|
542 |
$query->set('lang', $this->curlang->slug);
|
543 |
|
544 |
// remove pages query when the language is set unless we do a search
|
545 |
// FIXME is only search broken by this ?
|
546 |
-
if (!empty($qv['lang']) &&
|
547 |
$query->set('post_type', 'post');
|
548 |
|
549 |
// unset the is_archive flag for language pages to prevent loading the archive template
|
@@ -876,6 +881,7 @@ class Polylang_Core extends Polylang_base {
|
|
876 |
if ($trace['function'] == 'get_search_form')
|
877 |
$is_get_search_form = true;
|
878 |
|
|
|
879 |
if ($trace['function'] == 'wp_nav_menu' || $trace['function'] == 'login_footer' ||
|
880 |
// direct call from the theme
|
881 |
( !$is_get_search_form && isset($trace['file']) && strpos($trace['file'], $theme) !== false && in_array($trace['function'], array('home_url', 'get_home_url', 'bloginfo', 'get_bloginfo')) ))
|
@@ -919,7 +925,7 @@ class Polylang_Core extends Polylang_base {
|
|
919 |
{}
|
920 |
|
921 |
else
|
922 |
-
$this->set_post_language($post_id, get_current_language());
|
923 |
}
|
924 |
}
|
925 |
|
@@ -934,7 +940,7 @@ class Polylang_Core extends Polylang_base {
|
|
934 |
{}
|
935 |
|
936 |
else
|
937 |
-
$this->set_term_language($term_id, get_current_language());
|
938 |
}
|
939 |
}
|
940 |
|
@@ -944,7 +950,7 @@ class Polylang_Core extends Polylang_base {
|
|
944 |
'dropdown' => 0, // display as list and not as dropdown
|
945 |
'echo' => 1, // echoes the list
|
946 |
'hide_if_empty' => 1, // hides languages with no posts (or pages)
|
947 |
-
'menu' => 0, // not for nav menu
|
948 |
'show_flags' => 0, // don't show flags
|
949 |
'show_names' => 1, // show language names
|
950 |
'display_names_as' => 'name', // valid options are slug and name
|
@@ -962,6 +968,8 @@ class Polylang_Core extends Polylang_base {
|
|
962 |
$output = '';
|
963 |
|
964 |
foreach ($this->get_languages_list(array('hide_empty' => $hide_if_empty)) as $language) {
|
|
|
|
|
965 |
// hide current language
|
966 |
if ($this->curlang->term_id == $language->term_id && $hide_current)
|
967 |
continue;
|
@@ -969,7 +977,8 @@ class Polylang_Core extends Polylang_base {
|
|
969 |
$url = $post_id !== null && ($tr_id = $this->get_post($post_id, $language)) ? get_permalink($tr_id) :
|
970 |
$post_id === null && !$force_home ? $this->get_translation_url($language) : null;
|
971 |
|
972 |
-
|
|
|
973 |
|
974 |
$url = apply_filters('pll_the_language_link', $url, $language->slug, $language->description);
|
975 |
|
@@ -979,34 +988,38 @@ class Polylang_Core extends Polylang_base {
|
|
979 |
|
980 |
$url = isset($url) ? $url : $this->get_home_url($language); // if the page is not translated, link to the home page
|
981 |
|
982 |
-
$
|
983 |
-
|
984 |
-
|
985 |
|
986 |
$flag = $show_flags ? $this->get_flag($language) : '';
|
987 |
$name = $show_names || !$show_flags ? esc_html($display_names_as == 'slug' ? $language->slug : $language->name) : '';
|
988 |
|
989 |
-
if (
|
990 |
$i = clone $item;
|
991 |
$i->title = $show_flags && $show_names ? $flag.' '.$name : $flag.$name;
|
992 |
$i->url = $url;
|
993 |
$i->lang = $language->slug; // save this for use in nav_menu_link_attributes
|
994 |
-
$i->classes = $
|
995 |
$output[] = $i;
|
996 |
}
|
997 |
-
else
|
|
|
|
|
|
|
998 |
$output .= sprintf("<li class='%s'><a hreflang='%s' href='%s'>%s</a></li>\n",
|
999 |
-
$
|
1000 |
esc_attr($language->slug),
|
1001 |
esc_url($url),
|
1002 |
$show_flags && $show_names ? $flag.' '.$name : $flag.$name
|
1003 |
);
|
|
|
1004 |
}
|
1005 |
}
|
1006 |
|
1007 |
$output = apply_filters('pll_the_languages', $output, $args);
|
1008 |
|
1009 |
-
if(!$echo ||
|
1010 |
return $output;
|
1011 |
echo $output;
|
1012 |
}
|
200 |
return $this->curlang;
|
201 |
|
202 |
// no language set for 404
|
203 |
+
if (is_404() || current_filter() == 'login_init' || (is_attachment() && !$this->options['media_support']))
|
204 |
return $this->get_preferred_language();
|
205 |
|
206 |
if ($var = get_query_var('lang'))
|
292 |
add_action('wp', array(&$this, 'check_language_code_in_url')); // before Wordpress redirect_canonical
|
293 |
}
|
294 |
|
295 |
+
$GLOBALS['wpdb']->termmeta = $GLOBALS['wpdb']->prefix . 'termmeta'; // registers the termmeta table in wpdb
|
296 |
$GLOBALS['text_direction'] = get_metadata('term', $this->curlang->term_id, '_rtl', true) ? 'rtl' : 'ltr';
|
297 |
$GLOBALS['l10n']['pll_string'] = $this->mo_import($this->curlang);
|
298 |
do_action('pll_language_defined');
|
436 |
// don't redirect if $_POST is not empty as it could break other plugins
|
437 |
// don't forget the query string which may be added by plugins
|
438 |
elseif (is_string($redirect = $this->get_home_url($this->curlang)) && empty($_POST)) {
|
439 |
+
$redirect = empty($_SERVER['QUERY_STRING']) ? $redirect : $redirect . ($this->using_permalinks ? '?' : '&') . $_SERVER['QUERY_STRING'];
|
440 |
+
if ($redirect = apply_filters('pll_redirect_home', $redirect)) {
|
441 |
+
wp_redirect($redirect);
|
442 |
+
exit;
|
443 |
+
}
|
444 |
}
|
445 |
}
|
446 |
|
462 |
if (!$this->first_query && $this->curlang && !empty($qv['lang']))
|
463 |
return;
|
464 |
|
465 |
+
$is_post_type = !empty($qv['post_type']) && (
|
466 |
in_array($qv['post_type'], $this->post_types) ||
|
467 |
(is_array($qv['post_type']) && array_intersect($qv['post_type'], $this->post_types))
|
468 |
);
|
469 |
|
470 |
// don't filters post types not in our list
|
471 |
+
if (!empty($qv['post_type']) && !$is_post_type)
|
472 |
return;
|
473 |
|
474 |
$this->first_query = false;
|
502 |
|
503 |
// sets is_home on translated home page when it displays posts
|
504 |
// is_home must be true on page 2, 3... too
|
505 |
+
// as well as when searching an empty string: http://wordpress.org/support/topic/plugin-polylang-polylang-breaks-search-in-spun-theme
|
506 |
+
if (!$this->page_on_front && is_tax('language') && (count($query->query) == 1 || (is_paged() && count($query->query) == 2) || (isset($query->query['s']) && !$query->query['s']))) {
|
507 |
$this->curlang = $this->get_language(get_query_var('lang')); // sets the language now otherwise it will be too late to filter sticky posts !
|
508 |
$query->is_home = true;
|
509 |
$query->is_archive = $query->is_tax = false;
|
531 |
$is_archive = (count($query->query) == 1 && !empty($qv['paged'])) ||
|
532 |
$query->is_date ||
|
533 |
$query->is_author ||
|
534 |
+
(!empty($qv['post_type']) && $query->is_post_type_archive && $is_post_type);
|
535 |
|
536 |
// sets 404 when the language is not set for archives needing the language in the url
|
537 |
if (!$this->options['hide_default'] && !isset($qv['lang']) && !$this->using_permalinks && $is_archive)
|
543 |
|
544 |
// allow filtering recent posts and secondary queries by the current language
|
545 |
// take care not to break queries for non visible post types such as nav_menu_items, attachments...
|
546 |
+
if (/*$query->is_home && */$this->curlang && (empty($qv['post_type']) || $is_post_type ))
|
547 |
$query->set('lang', $this->curlang->slug);
|
548 |
|
549 |
// remove pages query when the language is set unless we do a search
|
550 |
// FIXME is only search broken by this ?
|
551 |
+
if (!empty($qv['lang']) && empty($qv['post_type']) && !$query->is_search)
|
552 |
$query->set('post_type', 'post');
|
553 |
|
554 |
// unset the is_archive flag for language pages to prevent loading the archive template
|
881 |
if ($trace['function'] == 'get_search_form')
|
882 |
$is_get_search_form = true;
|
883 |
|
884 |
+
|
885 |
if ($trace['function'] == 'wp_nav_menu' || $trace['function'] == 'login_footer' ||
|
886 |
// direct call from the theme
|
887 |
( !$is_get_search_form && isset($trace['file']) && strpos($trace['file'], $theme) !== false && in_array($trace['function'], array('home_url', 'get_home_url', 'bloginfo', 'get_bloginfo')) ))
|
925 |
{}
|
926 |
|
927 |
else
|
928 |
+
$this->set_post_language($post_id, $this->get_current_language());
|
929 |
}
|
930 |
}
|
931 |
|
940 |
{}
|
941 |
|
942 |
else
|
943 |
+
$this->set_term_language($term_id, $this->get_current_language());
|
944 |
}
|
945 |
}
|
946 |
|
950 |
'dropdown' => 0, // display as list and not as dropdown
|
951 |
'echo' => 1, // echoes the list
|
952 |
'hide_if_empty' => 1, // hides languages with no posts (or pages)
|
953 |
+
'menu' => 0, // not for nav menu (this argument is deprecated since v1.1.1)
|
954 |
'show_flags' => 0, // don't show flags
|
955 |
'show_names' => 1, // show language names
|
956 |
'display_names_as' => 'name', // valid options are slug and name
|
968 |
$output = '';
|
969 |
|
970 |
foreach ($this->get_languages_list(array('hide_empty' => $hide_if_empty)) as $language) {
|
971 |
+
$classes = array();
|
972 |
+
|
973 |
// hide current language
|
974 |
if ($this->curlang->term_id == $language->term_id && $hide_current)
|
975 |
continue;
|
977 |
$url = $post_id !== null && ($tr_id = $this->get_post($post_id, $language)) ? get_permalink($tr_id) :
|
978 |
$post_id === null && !$force_home ? $this->get_translation_url($language) : null;
|
979 |
|
980 |
+
if (!isset($url))
|
981 |
+
$classes[] = 'no-translation ';
|
982 |
|
983 |
$url = apply_filters('pll_the_language_link', $url, $language->slug, $language->description);
|
984 |
|
988 |
|
989 |
$url = isset($url) ? $url : $this->get_home_url($language); // if the page is not translated, link to the home page
|
990 |
|
991 |
+
array_push($classes, 'lang-item', 'lang-item-' . esc_attr($language->term_id), 'lang-item-' . esc_attr($language->slug));
|
992 |
+
if ($language->term_id == $this->curlang->term_id)
|
993 |
+
$classes[] = 'current-lang';
|
994 |
|
995 |
$flag = $show_flags ? $this->get_flag($language) : '';
|
996 |
$name = $show_names || !$show_flags ? esc_html($display_names_as == 'slug' ? $language->slug : $language->name) : '';
|
997 |
|
998 |
+
if (isset($item)) {
|
999 |
$i = clone $item;
|
1000 |
$i->title = $show_flags && $show_names ? $flag.' '.$name : $flag.$name;
|
1001 |
$i->url = $url;
|
1002 |
$i->lang = $language->slug; // save this for use in nav_menu_link_attributes
|
1003 |
+
$i->classes = $classes;
|
1004 |
$output[] = $i;
|
1005 |
}
|
1006 |
+
else {
|
1007 |
+
if ($menu)
|
1008 |
+
$classes[] = 'menu-item'; // backward compatibility
|
1009 |
+
|
1010 |
$output .= sprintf("<li class='%s'><a hreflang='%s' href='%s'>%s</a></li>\n",
|
1011 |
+
implode(' ', $classes),
|
1012 |
esc_attr($language->slug),
|
1013 |
esc_url($url),
|
1014 |
$show_flags && $show_names ? $flag.' '.$name : $flag.$name
|
1015 |
);
|
1016 |
+
}
|
1017 |
}
|
1018 |
}
|
1019 |
|
1020 |
$output = apply_filters('pll_the_languages', $output, $args);
|
1021 |
|
1022 |
+
if (!$echo || isset($item))
|
1023 |
return $output;
|
1024 |
echo $output;
|
1025 |
}
|
include/nav-menu.php
CHANGED
@@ -1,24 +1,16 @@
|
|
1 |
<?php
|
2 |
class Polylang_Nav_Menu {
|
3 |
-
|
4 |
public function __construct() {
|
5 |
if ($GLOBALS['polylang']->is_admin) {
|
6 |
// integration in the WP menu interface
|
7 |
add_action('admin_init', array(&$this, 'admin_init'), 20); // ater update
|
8 |
-
add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
|
9 |
-
add_action('wp_update_nav_menu_item', array(&$this, 'wp_update_nav_menu_item'), 10, 3);
|
10 |
-
add_filter('wp_get_nav_menu_items', array(&$this, 'wp_get_nav_menu_items'));
|
11 |
-
|
12 |
-
// translation of menus based on chosen locations
|
13 |
-
$theme = get_option( 'stylesheet' );
|
14 |
-
add_filter("pre_update_option_theme_mods_$theme", array($this, 'update_nav_menu_locations'));
|
15 |
|
16 |
-
//
|
17 |
-
add_action('
|
18 |
}
|
19 |
-
|
20 |
else {
|
21 |
// split the language switcher menu item in several language menu items
|
|
|
22 |
add_filter('wp_nav_menu_objects', array(&$this, 'wp_nav_menu_objects'));
|
23 |
add_filter('nav_menu_link_attributes', array(&$this, 'nav_menu_link_attributes'), 10, 3);
|
24 |
|
@@ -29,14 +21,29 @@ class Polylang_Nav_Menu {
|
|
29 |
|
30 |
// add the language switcher metabox and create new nav menu locations
|
31 |
public function admin_init(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
// FIXME is it possible to choose the order (after theme locations in WP3.5 and older) ?
|
33 |
add_meta_box('pll_lang_switch_box', __('Language switcher', 'polylang'), array( &$this, 'lang_switch' ), 'nav-menus', 'side', 'high');
|
34 |
|
35 |
// create new nav menu locations except for all non-default language (only on admin side)
|
36 |
-
global $_wp_registered_nav_menus, $polylang;
|
37 |
if (isset($_wp_registered_nav_menus)) {
|
38 |
foreach ($_wp_registered_nav_menus as $loc => $name)
|
39 |
-
foreach ($
|
40 |
$arr[$loc . (pll_default_language() == $lang->slug ? '' : '#' . $lang->slug)] = $name . ' ' . $lang->name;
|
41 |
|
42 |
$_wp_registered_nav_menus = $arr;
|
@@ -125,10 +132,10 @@ class Polylang_Nav_Menu {
|
|
125 |
}
|
126 |
|
127 |
// translates the language switcher menu items title in case the user swirhces the admin language
|
128 |
-
function
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
return $items;
|
133 |
}
|
134 |
|
@@ -171,22 +178,71 @@ class Polylang_Nav_Menu {
|
|
171 |
add_filter('option_nav_menu_options', create_function('$a', "\$a['auto_add'] = array_intersect(\$a['auto_add'], array($menus)); return \$a;"));
|
172 |
}
|
173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
// split the one item of backend in several items on frontend
|
175 |
-
|
|
|
176 |
global $polylang;
|
177 |
$new_items = array();
|
|
|
178 |
|
179 |
foreach ($items as $key => $item) {
|
180 |
-
if ($options = get_post_meta($item->ID, '_pll_menu_item', true))
|
181 |
-
$
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
$new_items[] = $item;
|
|
|
184 |
}
|
185 |
|
186 |
return $new_items;
|
187 |
}
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
// hreflang attribute for the language switcher menu items
|
|
|
190 |
function nav_menu_link_attributes($atts, $item, $args) {
|
191 |
if (isset($item->lang))
|
192 |
$atts['hreflang'] = $item->lang;
|
@@ -194,11 +250,15 @@ class Polylang_Nav_Menu {
|
|
194 |
}
|
195 |
|
196 |
// get the menu in the correct language
|
|
|
197 |
function get_nav_menu($term) {
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
|
|
|
|
|
|
202 |
return $term;
|
203 |
}
|
204 |
}
|
1 |
<?php
|
2 |
class Polylang_Nav_Menu {
|
|
|
3 |
public function __construct() {
|
4 |
if ($GLOBALS['polylang']->is_admin) {
|
5 |
// integration in the WP menu interface
|
6 |
add_action('admin_init', array(&$this, 'admin_init'), 20); // ater update
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
// remove the customize menu section as it is unusable with Polylang
|
9 |
+
add_action('customize_register', array(&$this, 'customize_register'), 20); // since WP 3.4
|
10 |
}
|
|
|
11 |
else {
|
12 |
// split the language switcher menu item in several language menu items
|
13 |
+
add_filter('wp_get_nav_menu_items', array(&$this, 'wp_get_nav_menu_items'));
|
14 |
add_filter('wp_nav_menu_objects', array(&$this, 'wp_nav_menu_objects'));
|
15 |
add_filter('nav_menu_link_attributes', array(&$this, 'nav_menu_link_attributes'), 10, 3);
|
16 |
|
21 |
|
22 |
// add the language switcher metabox and create new nav menu locations
|
23 |
public function admin_init(){
|
24 |
+
global $_wp_registered_nav_menus, $polylang;
|
25 |
+
|
26 |
+
if (!($languages = $polylang->get_languages_list()))
|
27 |
+
return;
|
28 |
+
|
29 |
+
add_action('admin_enqueue_scripts', array(&$this, 'admin_enqueue_scripts'));
|
30 |
+
add_action('wp_update_nav_menu_item', array(&$this, 'wp_update_nav_menu_item'), 10, 3);
|
31 |
+
add_filter('wp_get_nav_menu_items', array(&$this, 'translate_switcher_title'));
|
32 |
+
|
33 |
+
// translation of menus based on chosen locations
|
34 |
+
$theme = get_option( 'stylesheet' );
|
35 |
+
add_filter("pre_update_option_theme_mods_$theme", array($this, 'update_nav_menu_locations'));
|
36 |
+
|
37 |
+
// filter _wp_auto_add_pages_to_menu by language
|
38 |
+
add_action('transition_post_status', array(&$this, 'auto_add_pages_to_menu'), 5, 3); // before _wp_auto_add_pages_to_menu
|
39 |
+
|
40 |
// FIXME is it possible to choose the order (after theme locations in WP3.5 and older) ?
|
41 |
add_meta_box('pll_lang_switch_box', __('Language switcher', 'polylang'), array( &$this, 'lang_switch' ), 'nav-menus', 'side', 'high');
|
42 |
|
43 |
// create new nav menu locations except for all non-default language (only on admin side)
|
|
|
44 |
if (isset($_wp_registered_nav_menus)) {
|
45 |
foreach ($_wp_registered_nav_menus as $loc => $name)
|
46 |
+
foreach ($languages as $lang)
|
47 |
$arr[$loc . (pll_default_language() == $lang->slug ? '' : '#' . $lang->slug)] = $name . ' ' . $lang->name;
|
48 |
|
49 |
$_wp_registered_nav_menus = $arr;
|
132 |
}
|
133 |
|
134 |
// translates the language switcher menu items title in case the user swirhces the admin language
|
135 |
+
function translate_switcher_title($items) {
|
136 |
+
foreach ($items as $item)
|
137 |
+
if ($item->url == '#pll_switcher')
|
138 |
+
$item->post_title = __('Language switcher', 'polylang');
|
139 |
return $items;
|
140 |
}
|
141 |
|
178 |
add_filter('option_nav_menu_options', create_function('$a', "\$a['auto_add'] = array_intersect(\$a['auto_add'], array($menus)); return \$a;"));
|
179 |
}
|
180 |
|
181 |
+
// FIXME remove the customize menu section as it is currently unusable with Polylang
|
182 |
+
function customize_register() {
|
183 |
+
$GLOBALS['wp_customize']->remove_section('nav'); // since WP 3.4
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
// split the one item of backend in several items on frontend
|
188 |
+
// take care to menu_order as it is used later in wp_nav_menu
|
189 |
+
function wp_get_nav_menu_items($items) {
|
190 |
global $polylang;
|
191 |
$new_items = array();
|
192 |
+
$offset = 0;
|
193 |
|
194 |
foreach ($items as $key => $item) {
|
195 |
+
if ($options = get_post_meta($item->ID, '_pll_menu_item', true)) {
|
196 |
+
$i = 0;
|
197 |
+
|
198 |
+
foreach ($lang_items = $polylang->the_languages(array_merge(array('item' => $item), $options)) as $lang_item)
|
199 |
+
$lang_item->menu_order += $offset + $i++;
|
200 |
+
|
201 |
+
$offset += $i - 1;
|
202 |
+
$new_items = array_merge($new_items, $lang_items);
|
203 |
+
}
|
204 |
+
else {
|
205 |
+
$item->menu_order += $offset;
|
206 |
$new_items[] = $item;
|
207 |
+
}
|
208 |
}
|
209 |
|
210 |
return $new_items;
|
211 |
}
|
212 |
|
213 |
+
function get_ancestors($item) {
|
214 |
+
$ids = array();
|
215 |
+
$_anc_id = (int) $item->db_id;
|
216 |
+
while(($_anc_id = get_post_meta($_anc_id, '_menu_item_menu_item_parent', true)) && !in_array($_anc_id, $ids))
|
217 |
+
$ids[] = $_anc_id;
|
218 |
+
return $ids;
|
219 |
+
}
|
220 |
+
|
221 |
+
// remove current-menu and current-menu-ancestor classes to lang switcher when not on the home page
|
222 |
+
function wp_nav_menu_objects($items) {
|
223 |
+
$r_ids = $k_ids = array();
|
224 |
+
|
225 |
+
foreach ($items as $item) {
|
226 |
+
if (in_array('current-lang', $item->classes)) {
|
227 |
+
$item->classes = array_diff($item->classes, array('current-menu-item'));
|
228 |
+
$r_ids = array_merge($r_ids, $this->get_ancestors($item)); // remove the classes for these ancestors
|
229 |
+
}
|
230 |
+
elseif (in_array('current-menu-item', $item->classes))
|
231 |
+
$k_ids = array_merge($k_ids, $this->get_ancestors($item)); // keep the classes for these ancestors
|
232 |
+
}
|
233 |
+
|
234 |
+
$r_ids = array_diff($r_ids, $k_ids);
|
235 |
+
|
236 |
+
foreach ($items as $item) {
|
237 |
+
if (in_array($item->db_id, $r_ids))
|
238 |
+
$item->classes = array_diff($item->classes, array('current-menu-ancestor', 'current-menu-parent', 'current_page_parent', 'current_page_ancestor'));
|
239 |
+
}
|
240 |
+
|
241 |
+
return $items;
|
242 |
+
}
|
243 |
+
|
244 |
// hreflang attribute for the language switcher menu items
|
245 |
+
// available since WP3.6
|
246 |
function nav_menu_link_attributes($atts, $item, $args) {
|
247 |
if (isset($item->lang))
|
248 |
$atts['hreflang'] = $item->lang;
|
250 |
}
|
251 |
|
252 |
// get the menu in the correct language
|
253 |
+
// avoid infinite loop and http://core.trac.wordpress.org/ticket/9968
|
254 |
function get_nav_menu($term) {
|
255 |
+
static $once = false;
|
256 |
+
if (!$once && $tr = pll_get_term($term->term_id)) {
|
257 |
+
$once = true; // breaks the loop
|
258 |
+
$term = get_term($tr, 'nav_menu');
|
259 |
+
$once = false; // for the next call
|
260 |
+
}
|
261 |
+
|
262 |
return $term;
|
263 |
}
|
264 |
}
|
include/plugins-compat.php
CHANGED
@@ -16,6 +16,9 @@ class Polylang_Plugins_Compat {
|
|
16 |
|
17 |
// Custom field template
|
18 |
add_action('dbx_post_advanced', array(&$this, 'cft_copy'));
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
// Unfortunately WPSEO loads the text domain before Polylang is able to modify the locale
|
@@ -38,9 +41,18 @@ class Polylang_Plugins_Compat {
|
|
38 |
// Custom field template does check $_REQUEST['post'] to populate the custom fields values
|
39 |
function cft_copy() {
|
40 |
global $post, $custom_field_template;
|
41 |
-
if (isset($custom_field_template
|
42 |
$_REQUEST['post'] = $post->ID;
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
|
46 |
new Polylang_Plugins_Compat();
|
16 |
|
17 |
// Custom field template
|
18 |
add_action('dbx_post_advanced', array(&$this, 'cft_copy'));
|
19 |
+
|
20 |
+
// Jetpack infinite scroll
|
21 |
+
add_filter('pre_get_posts', array(&$this, 'jetpack_infinite_scroll'));
|
22 |
}
|
23 |
|
24 |
// Unfortunately WPSEO loads the text domain before Polylang is able to modify the locale
|
41 |
// Custom field template does check $_REQUEST['post'] to populate the custom fields values
|
42 |
function cft_copy() {
|
43 |
global $post, $custom_field_template;
|
44 |
+
if (isset($custom_field_template, $_REQUEST['from_post'], $_REQUEST['new_lang']) && !empty($post))
|
45 |
$_REQUEST['post'] = $post->ID;
|
46 |
}
|
47 |
+
|
48 |
+
// Currently it is not possible to set the language in ajax url so let's use our cookie
|
49 |
+
function jetpack_infinite_scroll($query) {
|
50 |
+
if (isset($_GET['infinity'], $_GET['page'])) {
|
51 |
+
$query->set('lang', $GLOBALS['polylang']->get_preferred_language()->slug);
|
52 |
+
if (empty($qv['post_type']) && !$query->is_search)
|
53 |
+
$query->set('post_type', 'post');
|
54 |
+
}
|
55 |
+
}
|
56 |
}
|
57 |
|
58 |
new Polylang_Plugins_Compat();
|
js/nav-menu.js
CHANGED
@@ -43,7 +43,7 @@ jQuery(document).ready(function($) {
|
|
43 |
value: 1
|
44 |
});
|
45 |
if ((typeof(pll_data.val[item]) != 'undefined' && pll_data.val[item][ids[i]] == 1) || (typeof(pll_data.val[item]) == 'undefined' && ids[i] == 'show_names')) // show_names as default value
|
46 |
-
cb.
|
47 |
label.prepend(cb);
|
48 |
}
|
49 |
});
|
43 |
value: 1
|
44 |
});
|
45 |
if ((typeof(pll_data.val[item]) != 'undefined' && pll_data.val[item][ids[i]] == 1) || (typeof(pll_data.val[item]) == 'undefined' && ids[i] == 'show_names')) // show_names as default value
|
46 |
+
cb.prop('checked', true);
|
47 |
label.prepend(cb);
|
48 |
}
|
49 |
});
|
js/nav-menu.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(
|
1 |
+
jQuery(document).ready(function(a){a("#update-nav-menu").bind("click",function(b){if(b.target&&b.target.className&&-1!=b.target.className.indexOf("item-edit")){a("input[value='#pll_switcher'][type=text]").parent().parent().parent().each(function(){var d=a(this).attr("id").substring(19);a(this).children(".description-thin,.field-link-target,.field-description,.field-url").remove();h=a("<input>").attr({type:"hidden",id:"edit-menu-item-title-"+d,name:"menu-item-title["+d+"]",value:pll_data.strings[4]});a(this).append(h);h=a("<input>").attr({type:"hidden",id:"edit-menu-item-url-"+d,name:"menu-item-url["+d+"]",value:"#pll_switcher"});a(this).append(h);h=a("<input>").attr({type:"hidden",id:"edit-menu-item-pll-detect-"+d,name:"menu-item-pll-detect["+d+"]",value:1});a(this).append(h);ids=Array("hide_current","force_home","show_flags","show_names");for(var c=0;c<ids.length;c++){p=a("<p>").attr("class","description");a(this).prepend(p);label=a("<label>").attr("for","menu-item-"+ids[c]+"-"+d).text(" "+pll_data.strings[c]);p.append(label);cb=a("<input>").attr({type:"checkbox",id:"edit-menu-item-"+ids[c]+"-"+d,name:"menu-item-"+ids[c]+"["+d+"]",value:1});if((typeof(pll_data.val[d])!="undefined"&&pll_data.val[d][ids[c]]==1)||(typeof(pll_data.val[d])=="undefined"&&ids[c]=="show_names")){cb.prop("checked",true)}label.prepend(cb)}})}})});
|
js/post.js
CHANGED
@@ -34,10 +34,7 @@ pll_tagBox = {
|
|
34 |
if ( !thetags.length )
|
35 |
return;
|
36 |
|
37 |
-
|
38 |
-
// disabled = thetags.prop('disabled'); // 3.3
|
39 |
-
// disabled = thetags.attr('disabled'); // 3.1
|
40 |
-
disabled = thetags.attr('disabled');
|
41 |
|
42 |
current_tags = thetags.val().split(',');
|
43 |
tagchecklist.empty();
|
@@ -233,10 +230,10 @@ jQuery(document).ready(function($) {
|
|
233 |
}
|
234 |
});
|
235 |
|
236 |
-
// modifies the language in the tag cloud
|
237 |
$('.tagcloud-link').each(function() {
|
238 |
var id = $(this).attr('id');
|
239 |
-
pll_tagBox.get(id, 0);
|
240 |
});
|
241 |
|
242 |
// modifies the language in the tags suggestion input
|
@@ -244,7 +241,7 @@ jQuery(document).ready(function($) {
|
|
244 |
});
|
245 |
});
|
246 |
|
247 |
-
// Tag box
|
248 |
// copy paste WP code
|
249 |
// replacing tagsdiv by pll-tagsdiv and tagBox by pll_tagBox
|
250 |
if ( $('#pll-tagsdiv-post_tag').length ) {
|
@@ -259,13 +256,13 @@ jQuery(document).ready(function($) {
|
|
259 |
}
|
260 |
|
261 |
// quick edit
|
262 |
-
|
263 |
inlineEditPost.revert();
|
264 |
var post_id = inlineEditPost.getId(this);
|
265 |
-
var lang = $(
|
266 |
$("input[name='old_lang']").val(lang);
|
267 |
-
$('#post_lang_choice option:selected').
|
268 |
-
$('#post_lang_choice option[value="'+lang+'"]').attr('selected', 'selected');
|
269 |
});
|
270 |
|
271 |
// ajax for changing the media's language
|
34 |
if ( !thetags.length )
|
35 |
return;
|
36 |
|
37 |
+
disabled = thetags.prop('disabled');
|
|
|
|
|
|
|
38 |
|
39 |
current_tags = thetags.val().split(',');
|
40 |
tagchecklist.empty();
|
230 |
}
|
231 |
});
|
232 |
|
233 |
+
// modifies the language in the tag cloud
|
234 |
$('.tagcloud-link').each(function() {
|
235 |
var id = $(this).attr('id');
|
236 |
+
pll_tagBox.get(id, 0);
|
237 |
});
|
238 |
|
239 |
// modifies the language in the tags suggestion input
|
241 |
});
|
242 |
});
|
243 |
|
244 |
+
// Tag box
|
245 |
// copy paste WP code
|
246 |
// replacing tagsdiv by pll-tagsdiv and tagBox by pll_tagBox
|
247 |
if ( $('#pll-tagsdiv-post_tag').length ) {
|
256 |
}
|
257 |
|
258 |
// quick edit
|
259 |
+
$('#the-list').on('click', 'a.editinline', function(){
|
260 |
inlineEditPost.revert();
|
261 |
var post_id = inlineEditPost.getId(this);
|
262 |
+
var lang = $('#lang_'+post_id).html();
|
263 |
$("input[name='old_lang']").val(lang);
|
264 |
+
$('#post_lang_choice option:selected').removeProp('selected');
|
265 |
+
$('#post_lang_choice option[value="'+lang+'"]').attr('selected', 'selected'); // FIXME why prop('selected', true) does not work?
|
266 |
});
|
267 |
|
268 |
// ajax for changing the media's language
|
js/post.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var pll_tagBox;(function(a){pll_tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.
|
1 |
+
var pll_tagBox;(function(a){pll_tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var g=a(".the-tags",d),e=a(".tagchecklist",d),f=a(d).attr("id"),b,c;if(!g.length){return}c=g.prop("disabled");b=g.val().split(",");e.empty();a.each(b,function(i,k){var j,h;k=a.trim(k);if(!k){return}j=a("<span />").text(k);if(!c){h=a('<a id="'+f+"-check-num-"+i+'" class="ntdelbutton">X</a>');h.click(function(){pll_tagBox.parseTags(this)});j.prepend(" ").prepend(h)}e.append(j)})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(e,b){var c=e.substr(e.indexOf("-")+1);var d={action:"get-tagcloud",lang:a("#post_lang_choice").attr("value"),tax:c};a.post(ajaxurl,d,function(g,f){if(0==g||"success"!=f){g=wpAjax.broken}g=a('<p id="tagcloud-'+c+'" class="the-tagcloud">'+g+"</p>");a("a",g).click(function(){pll_tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});if(b==1){a("#"+e).after(g)}else{v=a(".the-tagcloud").css("display");a(".the-tagcloud").replaceWith(g);a(".the-tagcloud").css("display",v)}})},suggest:function(){ajaxtag=a("div.ajaxtag");a("input.newtag",ajaxtag).unbind().blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(b){if(13==b.which){pll_tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(b){if(13==b.which){b.preventDefault();return false}}).each(function(){var c=a("#post_lang_choice").attr("value");var b=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=polylang-ajax-tag-search&lang="+c+"&tax="+b,{delay:500,minchars:2,multiple:true,multipleSep:","})})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){pll_tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});pll_tagBox.suggest();a("#post").submit(function(){a("div.tagsdiv").each(function(){pll_tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){pll_tagBox.get(a(this).attr("id"),1);a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}}})(jQuery);jQuery(document).ready(function(b){var a=new Array();b(".categorydiv").each(function(){var e=b(this).attr("id"),d,c;d=e.split("-");d.shift();c=d.join("-");a.push(c);b("#"+c+"-add-submit").before(b("<input />").attr("type","hidden").attr("id",c+"-lang").attr("name","term_lang_choice").attr("value",b("#post_lang_choice").attr("value")))});b("#post_lang_choice").change(function(){var c={action:"post_lang_choice",lang:b(this).attr("value"),taxonomies:a,post_id:b("#post_ID").attr("value")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b("#post-translations").html(this.data);break;case"taxonomy":var f=this.data;b("#"+f+"checklist").html(this.supplemental.all);b("#"+f+"checklist-pop").html(this.supplemental.populars);b("#new"+f+"_parent").replaceWith(this.supplemental.dropdown);b("#"+f+"-lang").val(b("#post_lang_choice").attr("value"));break;case"pages":b("#parent_id").replaceWith(this.data);break;default:break}});b(".tagcloud-link").each(function(){var f=b(this).attr("id");pll_tagBox.get(f,0)});pll_tagBox.suggest()})});if(b("#pll-tagsdiv-post_tag").length){pll_tagBox.init()}else{b("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("pll-tagsdiv-")===0){pll_tagBox.init();return false}})}b("#the-list").on("click","a.editinline",function(){inlineEditPost.revert();var c=inlineEditPost.getId(this);var d=b("#lang_"+c).html();b("input[name='old_lang']").val(d);b("#post_lang_choice option:selected").removeProp("selected");b('#post_lang_choice option[value="'+d+'"]').attr("selected","selected")});b(".media_lang_choice").change(function(){var c={action:"media_lang_choice",lang:b(this).attr("value"),post_id:b(this).attr("name")};b.post(ajaxurl,c,function(d){var e=wpAjax.parseAjaxResponse(d,"ajax-response");b.each(e.responses,function(){switch(this.what){case"translations":b(".translations").html(this.data);b(".compat-field-translations").html(this.data);break;default:break}})})})});
|
js/term.js
CHANGED
@@ -29,12 +29,12 @@ jQuery(document).ready(function($) {
|
|
29 |
});
|
30 |
|
31 |
// quick edit
|
32 |
-
|
33 |
inlineEditTax.revert();
|
34 |
var id = inlineEditTax.getId(this);
|
35 |
-
var lang = $(
|
36 |
$("input[name='old_lang']").val(lang);
|
37 |
-
$('#inline_lang_choice option:selected').
|
38 |
-
$('#inline_lang_choice option[value="'+lang+'"]').attr('selected', 'selected');
|
39 |
});
|
40 |
});
|
29 |
});
|
30 |
|
31 |
// quick edit
|
32 |
+
$('#the-list').on('click', 'a.editinline', function(){
|
33 |
inlineEditTax.revert();
|
34 |
var id = inlineEditTax.getId(this);
|
35 |
+
var lang = $('#lang_'+id).html();
|
36 |
$("input[name='old_lang']").val(lang);
|
37 |
+
$('#inline_lang_choice option:selected').removeProp('selected');
|
38 |
+
$('#inline_lang_choice option[value="'+lang+'"]').attr('selected', 'selected'); // FIXME why prop('selected', true) does not work?
|
39 |
});
|
40 |
});
|
js/term.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(a){a("#term_lang_choice").change(function(){var b={action:"term_lang_choice",lang:a(this).attr("value"),term_id:a("input[name='tag_ID']").attr("value"),taxonomy:a("input[name='taxonomy']").attr("value")};a.post(ajaxurl,b,function(c){var d=wpAjax.parseAjaxResponse(c,"ajax-response");a.each(d.responses,function(){switch(this.what){case"translations":a("#term-translations").html(this.data);break;case"parent":a("#parent").replaceWith(this.data);break;case"tag_cloud":a(".tagcloud").replaceWith(this.data);break;default:break}})})});
|
1 |
+
jQuery(document).ready(function(a){a("#term_lang_choice").change(function(){var b={action:"term_lang_choice",lang:a(this).attr("value"),term_id:a("input[name='tag_ID']").attr("value"),taxonomy:a("input[name='taxonomy']").attr("value")};a.post(ajaxurl,b,function(c){var d=wpAjax.parseAjaxResponse(c,"ajax-response");a.each(d.responses,function(){switch(this.what){case"translations":a("#term-translations").html(this.data);break;case"parent":a("#parent").replaceWith(this.data);break;case"tag_cloud":a(".tagcloud").replaceWith(this.data);break;default:break}})})});a("#the-list").on("click","a.editinline",function(){inlineEditTax.revert();var c=inlineEditTax.getId(this);var b=a("#lang_"+c).html();a("input[name='old_lang']").val(b);a("#inline_lang_choice option:selected").removeProp("selected");a('#inline_lang_choice option[value="'+b+'"]').attr("selected","selected")})});
|
languages/polylang-nb_NO.mo
CHANGED
Binary file
|
languages/polylang-nb_NO.po
CHANGED
@@ -3,7 +3,7 @@ msgstr ""
|
|
3 |
"Project-Id-Version: Polylang v0.9.8\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
-
"PO-Revision-Date: 2013-
|
7 |
"Last-Translator: Tom Boersma <info@oransje.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -15,26 +15,41 @@ msgstr ""
|
|
15 |
"_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"
|
16 |
"X-Poedit-Basepath: ../\n"
|
17 |
"X-Textdomain-Support: yes\n"
|
18 |
-
"X-Generator: Poedit 1.5.
|
19 |
"X-Poedit-SearchPath-0: .\n"
|
20 |
|
21 |
# @ polylang
|
22 |
#: include/about.php:3
|
23 |
#, php-format
|
24 |
-
msgid "
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
# @ polylang
|
28 |
#: include/about.php:9
|
29 |
#, php-format
|
30 |
-
msgid "
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
# @ polylang
|
34 |
#: include/about.php:16
|
35 |
#, php-format
|
36 |
-
msgid "
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
# @ polylang
|
40 |
#: include/about.php:22
|
@@ -44,17 +59,17 @@ msgstr "Hvis du lurer på hvordan du kan hjelpe prosjektet, %sles her%s."
|
|
44 |
|
45 |
# @ polylang
|
46 |
#: include/about.php:27
|
47 |
-
msgid "
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
|
50 |
# @ polylang
|
51 |
-
#: include/admin-base.php:55
|
52 |
-
#: include/admin-
|
53 |
-
#: include/
|
54 |
-
#: include/admin.php:23
|
55 |
-
#: include/admin.php:301
|
56 |
-
#: include/list-table.php:13
|
57 |
-
#: polylang.php:339
|
58 |
msgid "Languages"
|
59 |
msgstr "Språk"
|
60 |
|
@@ -94,39 +109,29 @@ msgid "Show all languages"
|
|
94 |
msgstr "Vis alle språk"
|
95 |
|
96 |
# @ polylang
|
97 |
-
#: include/admin-filters.php:181
|
98 |
-
#: include/admin-filters.php:877
|
99 |
msgid "Add new translation"
|
100 |
msgstr "Legg til ny oversettelse"
|
101 |
|
102 |
# @ polylang
|
103 |
-
#: include/admin-filters.php:209
|
104 |
-
#: include/admin-filters.php:
|
105 |
-
#: include/admin-filters.php:
|
106 |
-
#: include/
|
107 |
-
#: include/
|
108 |
-
#: include/list-table.php:12
|
109 |
-
#: include/media-translations.php:5
|
110 |
-
#: include/media-translations.php:43
|
111 |
-
#: include/post-translations.php:8
|
112 |
-
#: include/term-translations.php:15
|
113 |
#: polylang.php:340
|
114 |
msgid "Language"
|
115 |
msgstr "Språk"
|
116 |
|
117 |
# @ polylang
|
118 |
-
#: include/admin-filters.php:616
|
119 |
-
#: include/
|
120 |
-
#: include/
|
121 |
-
#: include/media-translations.php:40
|
122 |
-
#: include/term-translations.php:6
|
123 |
-
#: include/term-translations.php:11
|
124 |
msgid "Translations"
|
125 |
msgstr "Oversettelser"
|
126 |
|
127 |
# @ polylang
|
128 |
-
#: include/admin-filters.php:819
|
129 |
-
#: include/admin-filters.php:838
|
130 |
msgid "Sets the language"
|
131 |
msgstr "Bestemmer språket"
|
132 |
|
@@ -136,8 +141,7 @@ msgid "The widget is displayed for:"
|
|
136 |
msgstr "Widgeten vises for:"
|
137 |
|
138 |
# @ polylang
|
139 |
-
#: include/admin-filters.php:1057
|
140 |
-
#: polylang.php:341
|
141 |
msgid "All languages"
|
142 |
msgstr "Alle språk"
|
143 |
|
@@ -153,8 +157,7 @@ msgstr "WordPress standard"
|
|
153 |
|
154 |
# @ default
|
155 |
# @ polylang
|
156 |
-
#: include/admin-filters.php:1114
|
157 |
-
#: include/admin.php:306
|
158 |
msgid "Settings"
|
159 |
msgstr "Innstillinger"
|
160 |
|
@@ -169,14 +172,12 @@ msgid "About Polylang"
|
|
169 |
msgstr "Om Polylang"
|
170 |
|
171 |
# @ polylang
|
172 |
-
#: include/admin.php:27
|
173 |
-
#: include/list-table.php:82
|
174 |
msgid "Strings translations"
|
175 |
msgstr "String oversettelser"
|
176 |
|
177 |
# @ polylang
|
178 |
-
#: include/admin.php:305
|
179 |
-
#: include/list-table.php:81
|
180 |
msgid "Strings translation"
|
181 |
msgstr "String oversettelse"
|
182 |
|
@@ -202,8 +203,12 @@ msgstr "Språket må ha et navn"
|
|
202 |
|
203 |
# @ polylang
|
204 |
#: include/admin.php:330
|
205 |
-
msgid "
|
206 |
-
|
|
|
|
|
|
|
|
|
207 |
|
208 |
# @ polylang
|
209 |
#: include/admin.php:449
|
@@ -271,8 +276,7 @@ msgid "Edit language"
|
|
271 |
msgstr "Rediger språk"
|
272 |
|
273 |
# @ polylang
|
274 |
-
#: include/languages-form.php:42
|
275 |
-
#: include/languages-form.php:123
|
276 |
msgid "Add new language"
|
277 |
msgstr "Legg til nytt språk"
|
278 |
|
@@ -287,8 +291,7 @@ msgid "You can choose a language in the list or directly edit it below."
|
|
287 |
msgstr "Du kan velge et språk fra listen eller redigere direkte nedenfor."
|
288 |
|
289 |
# @ polylang
|
290 |
-
#: include/languages-form.php:82
|
291 |
-
#: include/list-table.php:34
|
292 |
msgid "Full name"
|
293 |
msgstr "Fullt navn"
|
294 |
|
@@ -298,20 +301,23 @@ msgid "The name is how it is displayed on your site (for example: English)."
|
|
298 |
msgstr "Navnet som det vises på nettstedet ditt (for eksempel: English)."
|
299 |
|
300 |
# @ polylang
|
301 |
-
#: include/languages-form.php:88
|
302 |
-
#: include/list-table.php:35
|
303 |
msgid "Locale"
|
304 |
msgstr "Locale"
|
305 |
|
306 |
# @ polylang
|
307 |
#: include/languages-form.php:93
|
308 |
-
msgid "
|
309 |
-
|
|
|
|
|
|
|
|
|
310 |
|
311 |
# @ polylang
|
312 |
#: include/languages-form.php:97
|
313 |
msgid "Language code"
|
314 |
-
msgstr "
|
315 |
|
316 |
# @ polylang
|
317 |
#: include/languages-form.php:99
|
@@ -339,8 +345,7 @@ msgid "Choose the text direction for the language"
|
|
339 |
msgstr "Velg tekstretning for språket"
|
340 |
|
341 |
# @ polylang
|
342 |
-
#: include/languages-form.php:118
|
343 |
-
#: include/list-table.php:37
|
344 |
msgid "Order"
|
345 |
msgstr "Rekkefølge"
|
346 |
|
@@ -350,12 +355,8 @@ msgid "Position of the language in the language switcher"
|
|
350 |
msgstr "Språkets plasering i språkskifteren"
|
351 |
|
352 |
# @ polylang
|
353 |
-
#: include/nav-menu.php:28
|
354 |
-
#: include/nav-menu.php:
|
355 |
-
#: include/nav-menu.php:54
|
356 |
-
#: include/nav-menu.php:82
|
357 |
-
#: include/nav-menu.php:106
|
358 |
-
#: polylang.php:302
|
359 |
msgid "Language switcher"
|
360 |
msgstr "Språkskifter"
|
361 |
|
@@ -376,8 +377,12 @@ msgstr "Standard språk"
|
|
376 |
|
377 |
# @ polylang
|
378 |
#: include/languages-form.php:179
|
379 |
-
msgid "
|
380 |
-
|
|
|
|
|
|
|
|
|
381 |
|
382 |
# @ polylang
|
383 |
#: include/languages-form.php:187
|
@@ -386,7 +391,9 @@ msgstr "Detekter nettleserens språkpreferance"
|
|
386 |
|
387 |
# @ polylang
|
388 |
#: include/languages-form.php:193
|
389 |
-
msgid "
|
|
|
|
|
390 |
msgstr "Når forsiden besøkes, velg språk i henhold til nettleserens preferanse"
|
391 |
|
392 |
# @ polylang
|
@@ -396,13 +403,21 @@ msgstr "URL modifikasjoner"
|
|
396 |
|
397 |
# @ polylang
|
398 |
#: include/languages-form.php:206
|
399 |
-
msgid "
|
400 |
-
|
|
|
|
|
|
|
|
|
401 |
|
402 |
# @ polylang
|
403 |
#: include/languages-form.php:214
|
404 |
-
msgid "
|
405 |
-
|
|
|
|
|
|
|
|
|
406 |
|
407 |
# @ polylang
|
408 |
#: include/languages-form.php:223
|
@@ -422,8 +437,12 @@ msgstr "Skjul URL språkinformasjon for standard språk"
|
|
422 |
# @ polylang
|
423 |
#: include/languages-form.php:251
|
424 |
#, php-format
|
425 |
-
msgid "
|
426 |
-
|
|
|
|
|
|
|
|
|
427 |
|
428 |
# @ polylang
|
429 |
#: include/languages-form.php:260
|
@@ -461,19 +480,15 @@ msgid "Activate languages and translations for custom taxonomies."
|
|
461 |
msgstr "Aktiver språk og oversettelser for tilpassede taksonomier."
|
462 |
|
463 |
# @ polylang
|
464 |
-
#: include/list-table.php:26
|
465 |
-
#: include/media-translations.php:
|
466 |
-
#: include/
|
467 |
-
#: include/post-translations.php:10
|
468 |
-
#: include/post-translations.php:33
|
469 |
-
#: include/term-translations.php:18
|
470 |
#: include/term-translations.php:80
|
471 |
msgid "Edit"
|
472 |
msgstr "Rediger"
|
473 |
|
474 |
# @ polylang
|
475 |
-
#: include/list-table.php:27
|
476 |
-
#: include/list-table.php:162
|
477 |
msgid "Delete"
|
478 |
msgstr "Slett"
|
479 |
|
@@ -503,17 +518,14 @@ msgid "String"
|
|
503 |
msgstr "String"
|
504 |
|
505 |
# @ polylang
|
506 |
-
#: include/media-translations.php:6
|
507 |
-
#: include/media-translations.php:44
|
508 |
#: include/term-translations.php:16
|
509 |
msgid "Translation"
|
510 |
msgstr "Oversettelse"
|
511 |
|
512 |
# @ polylang
|
513 |
-
#: include/media-translations.php:31
|
514 |
-
#: include/
|
515 |
-
#: include/post-translations.php:38
|
516 |
-
#: include/term-translations.php:60
|
517 |
msgid "Add new"
|
518 |
msgstr "Legg til ny"
|
519 |
|
@@ -572,12 +584,16 @@ msgstr "Du bruker WordPress %s. Polylang krever minst WordPress %s."
|
|
572 |
# @ polylang
|
573 |
#: polylang.php:174
|
574 |
msgid "For some reasons, Polylang could not create a table in your database."
|
575 |
-
msgstr "
|
|
|
576 |
|
577 |
# @ polylang
|
578 |
#: polylang.php:235
|
579 |
-
msgid "
|
580 |
-
|
|
|
|
|
|
|
581 |
|
582 |
# @ polylang
|
583 |
#: polylang.php:237
|
@@ -588,10 +604,9 @@ msgstr "Vennligst oppgrader først til %s før du oppgraderer til %s."
|
|
588 |
# @ polylang
|
589 |
#: include/list-table.php:124
|
590 |
msgid "Group"
|
591 |
-
msgstr ""
|
592 |
|
593 |
# @ polylang
|
594 |
#: include/list-table.php:173
|
595 |
msgid "View all groups"
|
596 |
-
msgstr ""
|
597 |
-
|
3 |
"Project-Id-Version: Polylang v0.9.8\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-05-15 10:41+0100\n"
|
7 |
"Last-Translator: Tom Boersma <info@oransje.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
15 |
"_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"
|
16 |
"X-Poedit-Basepath: ../\n"
|
17 |
"X-Textdomain-Support: yes\n"
|
18 |
+
"X-Generator: Poedit 1.5.5\n"
|
19 |
"X-Poedit-SearchPath-0: .\n"
|
20 |
|
21 |
# @ polylang
|
22 |
#: include/about.php:3
|
23 |
#, php-format
|
24 |
+
msgid ""
|
25 |
+
"Polylang is provided with an extensive %sdocumentation%s (in English only). "
|
26 |
+
"It includes information on how to set up your multilingual site and use it "
|
27 |
+
"on a daily basis, a FAQ, as well as a documentation for programmers to adapt "
|
28 |
+
"their plugins and themes."
|
29 |
+
msgstr ""
|
30 |
+
"Polylang er utstyrt med omfattende %sdokumentasjon%s (bare på engelsk). Den "
|
31 |
+
"inneholder informasjon om hvordan du setter opp ditt flerspråklige nettsted "
|
32 |
+
"og bruker det på en daglig basis, en FAQ, samt dokumentasjon til "
|
33 |
+
"programmerere for å tilpasse sine plugins og temaer."
|
34 |
|
35 |
# @ polylang
|
36 |
#: include/about.php:9
|
37 |
#, php-format
|
38 |
+
msgid ""
|
39 |
+
"You will also find useful information in the %ssupport forum%s. However "
|
40 |
+
"don't forget to make a search before posting a new topic."
|
41 |
+
msgstr ""
|
42 |
+
"Du vil også finne nyttig informasjon i %sforumet%s. Men ikke glem å gjøre et "
|
43 |
+
"søk før du legger til et nytt emne."
|
44 |
|
45 |
# @ polylang
|
46 |
#: include/about.php:16
|
47 |
#, php-format
|
48 |
+
msgid ""
|
49 |
+
"Polylang is free of charge and is released under the same license as "
|
50 |
+
"WordPress, the %sGPL%s."
|
51 |
+
msgstr ""
|
52 |
+
"Polylang er gratis og er utgitt under samme lisens som WordPress, %sGPL%s."
|
53 |
|
54 |
# @ polylang
|
55 |
#: include/about.php:22
|
59 |
|
60 |
# @ polylang
|
61 |
#: include/about.php:27
|
62 |
+
msgid ""
|
63 |
+
"Finally if you like this plugin or if it helps your business, donations to "
|
64 |
+
"the author are greatly appreciated."
|
65 |
+
msgstr ""
|
66 |
+
"Til slutt, hvis du liker denne plugin'en eller hvis det hjelper din bedrift: "
|
67 |
+
"donasjoner til forfatteren er verdsatt i høyeste grad."
|
68 |
|
69 |
# @ polylang
|
70 |
+
#: include/admin-base.php:55 include/admin-base.php:190
|
71 |
+
#: include/admin-filters.php:243 include/admin.php:23 include/admin.php:301
|
72 |
+
#: include/list-table.php:13 polylang.php:339
|
|
|
|
|
|
|
|
|
73 |
msgid "Languages"
|
74 |
msgstr "Språk"
|
75 |
|
109 |
msgstr "Vis alle språk"
|
110 |
|
111 |
# @ polylang
|
112 |
+
#: include/admin-filters.php:181 include/admin-filters.php:877
|
|
|
113 |
msgid "Add new translation"
|
114 |
msgstr "Legg til ny oversettelse"
|
115 |
|
116 |
# @ polylang
|
117 |
+
#: include/admin-filters.php:209 include/admin-filters.php:267
|
118 |
+
#: include/admin-filters.php:601 include/admin-filters.php:817
|
119 |
+
#: include/admin-filters.php:835 include/list-table.php:12
|
120 |
+
#: include/media-translations.php:5 include/media-translations.php:43
|
121 |
+
#: include/post-translations.php:8 include/term-translations.php:15
|
|
|
|
|
|
|
|
|
|
|
122 |
#: polylang.php:340
|
123 |
msgid "Language"
|
124 |
msgstr "Språk"
|
125 |
|
126 |
# @ polylang
|
127 |
+
#: include/admin-filters.php:616 include/admin-filters.php:651
|
128 |
+
#: include/list-table.php:127 include/media-translations.php:40
|
129 |
+
#: include/term-translations.php:6 include/term-translations.php:11
|
|
|
|
|
|
|
130 |
msgid "Translations"
|
131 |
msgstr "Oversettelser"
|
132 |
|
133 |
# @ polylang
|
134 |
+
#: include/admin-filters.php:819 include/admin-filters.php:838
|
|
|
135 |
msgid "Sets the language"
|
136 |
msgstr "Bestemmer språket"
|
137 |
|
141 |
msgstr "Widgeten vises for:"
|
142 |
|
143 |
# @ polylang
|
144 |
+
#: include/admin-filters.php:1057 polylang.php:341
|
|
|
145 |
msgid "All languages"
|
146 |
msgstr "Alle språk"
|
147 |
|
157 |
|
158 |
# @ default
|
159 |
# @ polylang
|
160 |
+
#: include/admin-filters.php:1114 include/admin.php:306
|
|
|
161 |
msgid "Settings"
|
162 |
msgstr "Innstillinger"
|
163 |
|
172 |
msgstr "Om Polylang"
|
173 |
|
174 |
# @ polylang
|
175 |
+
#: include/admin.php:27 include/list-table.php:82
|
|
|
176 |
msgid "Strings translations"
|
177 |
msgstr "String oversettelser"
|
178 |
|
179 |
# @ polylang
|
180 |
+
#: include/admin.php:305 include/list-table.php:81
|
|
|
181 |
msgid "Strings translation"
|
182 |
msgstr "String oversettelse"
|
183 |
|
203 |
|
204 |
# @ polylang
|
205 |
#: include/admin.php:330
|
206 |
+
msgid ""
|
207 |
+
"The language was created, but the WordPress language file was not "
|
208 |
+
"downloaded. Please install it manually."
|
209 |
+
msgstr ""
|
210 |
+
"Språket ble opprettet, men WordPress språkfilen ble ikke lastet ned. "
|
211 |
+
"Vennligst installer den manuelt."
|
212 |
|
213 |
# @ polylang
|
214 |
#: include/admin.php:449
|
276 |
msgstr "Rediger språk"
|
277 |
|
278 |
# @ polylang
|
279 |
+
#: include/languages-form.php:42 include/languages-form.php:123
|
|
|
280 |
msgid "Add new language"
|
281 |
msgstr "Legg til nytt språk"
|
282 |
|
291 |
msgstr "Du kan velge et språk fra listen eller redigere direkte nedenfor."
|
292 |
|
293 |
# @ polylang
|
294 |
+
#: include/languages-form.php:82 include/list-table.php:34
|
|
|
295 |
msgid "Full name"
|
296 |
msgstr "Fullt navn"
|
297 |
|
301 |
msgstr "Navnet som det vises på nettstedet ditt (for eksempel: English)."
|
302 |
|
303 |
# @ polylang
|
304 |
+
#: include/languages-form.php:88 include/list-table.php:35
|
|
|
305 |
msgid "Locale"
|
306 |
msgstr "Locale"
|
307 |
|
308 |
# @ polylang
|
309 |
#: include/languages-form.php:93
|
310 |
+
msgid ""
|
311 |
+
"Wordpress Locale for the language (for example: en_US). You will need to "
|
312 |
+
"install the .mo file for this language."
|
313 |
+
msgstr ""
|
314 |
+
"Wordpress Locale for språket (for eksempel: en_US). Du må installere .mo "
|
315 |
+
"filen for dette språket."
|
316 |
|
317 |
# @ polylang
|
318 |
#: include/languages-form.php:97
|
319 |
msgid "Language code"
|
320 |
+
msgstr "Språkkode"
|
321 |
|
322 |
# @ polylang
|
323 |
#: include/languages-form.php:99
|
345 |
msgstr "Velg tekstretning for språket"
|
346 |
|
347 |
# @ polylang
|
348 |
+
#: include/languages-form.php:118 include/list-table.php:37
|
|
|
349 |
msgid "Order"
|
350 |
msgstr "Rekkefølge"
|
351 |
|
355 |
msgstr "Språkets plasering i språkskifteren"
|
356 |
|
357 |
# @ polylang
|
358 |
+
#: include/nav-menu.php:28 include/nav-menu.php:51 include/nav-menu.php:54
|
359 |
+
#: include/nav-menu.php:82 include/nav-menu.php:106 polylang.php:302
|
|
|
|
|
|
|
|
|
360 |
msgid "Language switcher"
|
361 |
msgstr "Språkskifter"
|
362 |
|
377 |
|
378 |
# @ polylang
|
379 |
#: include/languages-form.php:179
|
380 |
+
msgid ""
|
381 |
+
"There are posts, pages, categories or tags without language set. Do you want "
|
382 |
+
"to set them all to default language ?"
|
383 |
+
msgstr ""
|
384 |
+
"Det finnes innlegg, sider, kategorier eller tags uten et valgt språk. Vil du "
|
385 |
+
"sette dem alle til standard språk?"
|
386 |
|
387 |
# @ polylang
|
388 |
#: include/languages-form.php:187
|
391 |
|
392 |
# @ polylang
|
393 |
#: include/languages-form.php:193
|
394 |
+
msgid ""
|
395 |
+
"When the front page is visited, set the language according to the browser "
|
396 |
+
"preference"
|
397 |
msgstr "Når forsiden besøkes, velg språk i henhold til nettleserens preferanse"
|
398 |
|
399 |
# @ polylang
|
403 |
|
404 |
# @ polylang
|
405 |
#: include/languages-form.php:206
|
406 |
+
msgid ""
|
407 |
+
"The language is set from content. Posts, pages, categories and tags urls are "
|
408 |
+
"not modified."
|
409 |
+
msgstr ""
|
410 |
+
"Språket er satt fra innhold. Innlegg, sider, kategorier og tags urls er ikke "
|
411 |
+
"endret."
|
412 |
|
413 |
# @ polylang
|
414 |
#: include/languages-form.php:214
|
415 |
+
msgid ""
|
416 |
+
"The language code, for example /en/, is added to all urls when using pretty "
|
417 |
+
"permalinks."
|
418 |
+
msgstr ""
|
419 |
+
"Språkkoden, for eksempel /en/, er lagt til alle urls når du bruker pene "
|
420 |
+
"permalenker"
|
421 |
|
422 |
# @ polylang
|
423 |
#: include/languages-form.php:223
|
437 |
# @ polylang
|
438 |
#: include/languages-form.php:251
|
439 |
#, php-format
|
440 |
+
msgid ""
|
441 |
+
"When using static front page, redirect the language page (example: %s) to "
|
442 |
+
"the front page in the right language"
|
443 |
+
msgstr ""
|
444 |
+
"Når du bruker en statisk forside, omdiriger språksiden (eksempel: %s) til "
|
445 |
+
"forsiden på riktig språk"
|
446 |
|
447 |
# @ polylang
|
448 |
#: include/languages-form.php:260
|
480 |
msgstr "Aktiver språk og oversettelser for tilpassede taksonomier."
|
481 |
|
482 |
# @ polylang
|
483 |
+
#: include/list-table.php:26 include/media-translations.php:22
|
484 |
+
#: include/media-translations.php:60 include/post-translations.php:10
|
485 |
+
#: include/post-translations.php:33 include/term-translations.php:18
|
|
|
|
|
|
|
486 |
#: include/term-translations.php:80
|
487 |
msgid "Edit"
|
488 |
msgstr "Rediger"
|
489 |
|
490 |
# @ polylang
|
491 |
+
#: include/list-table.php:27 include/list-table.php:162
|
|
|
492 |
msgid "Delete"
|
493 |
msgstr "Slett"
|
494 |
|
518 |
msgstr "String"
|
519 |
|
520 |
# @ polylang
|
521 |
+
#: include/media-translations.php:6 include/media-translations.php:44
|
|
|
522 |
#: include/term-translations.php:16
|
523 |
msgid "Translation"
|
524 |
msgstr "Oversettelse"
|
525 |
|
526 |
# @ polylang
|
527 |
+
#: include/media-translations.php:31 include/media-translations.php:68
|
528 |
+
#: include/post-translations.php:38 include/term-translations.php:60
|
|
|
|
|
529 |
msgid "Add new"
|
530 |
msgstr "Legg til ny"
|
531 |
|
584 |
# @ polylang
|
585 |
#: polylang.php:174
|
586 |
msgid "For some reasons, Polylang could not create a table in your database."
|
587 |
+
msgstr ""
|
588 |
+
"Av en eller annen grunn kan ikke Polylang legge til en tabell i din database."
|
589 |
|
590 |
# @ polylang
|
591 |
#: polylang.php:235
|
592 |
+
msgid ""
|
593 |
+
"Polylang has been deactivated because you upgraded from a too old version."
|
594 |
+
msgstr ""
|
595 |
+
"Polylang er blitt deaktivert fordi at du har oppgradert fra en for gammel "
|
596 |
+
"versjon."
|
597 |
|
598 |
# @ polylang
|
599 |
#: polylang.php:237
|
604 |
# @ polylang
|
605 |
#: include/list-table.php:124
|
606 |
msgid "Group"
|
607 |
+
msgstr "Gruppe"
|
608 |
|
609 |
# @ polylang
|
610 |
#: include/list-table.php:173
|
611 |
msgid "View all groups"
|
612 |
+
msgstr "Vis alle grupper"
|
|
polylang.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
-
Version: 1.1
|
6 |
Author: Frédéric Demarle
|
7 |
Description: Adds multilingual capability to WordPress
|
8 |
Text Domain: polylang
|
@@ -29,7 +29,7 @@ Domain Path: /languages
|
|
29 |
*
|
30 |
*/
|
31 |
|
32 |
-
define('POLYLANG_VERSION', '1.1');
|
33 |
define('PLL_MIN_WP_VERSION', '3.1');
|
34 |
|
35 |
define('POLYLANG_DIR', dirname(__FILE__)); // our directory
|
@@ -49,7 +49,7 @@ if (!defined('PLL_LOCAL_URL'))
|
|
49 |
if (!defined('PLL_COOKIE'))
|
50 |
define('PLL_COOKIE', 'pll_language'); // cookie name. no cookie will be used if set to false
|
51 |
|
52 |
-
if (!defined('PLL_SEARCH_FORM_JS') && version_compare($GLOBALS['wp_version'], '3.6', '<'))
|
53 |
define('PLL_SEARCH_FORM_JS', false); // the search form js is no more needed in WP 3.6+ except if the search form is hardcoded elsewhere than in searchform.php
|
54 |
|
55 |
require_once(PLL_INC.'/base.php');
|
@@ -72,7 +72,7 @@ class Polylang extends Polylang_Base {
|
|
72 |
}
|
73 |
|
74 |
// stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules)
|
75 |
-
if (isset($_GET['action']) && $_GET['action'] == 'deactivate' &&
|
76 |
return;
|
77 |
|
78 |
// blog creation on multisite
|
2 |
/*
|
3 |
Plugin Name: Polylang
|
4 |
Plugin URI: http://polylang.wordpress.com/
|
5 |
+
Version: 1.1.1
|
6 |
Author: Frédéric Demarle
|
7 |
Description: Adds multilingual capability to WordPress
|
8 |
Text Domain: polylang
|
29 |
*
|
30 |
*/
|
31 |
|
32 |
+
define('POLYLANG_VERSION', '1.1.1');
|
33 |
define('PLL_MIN_WP_VERSION', '3.1');
|
34 |
|
35 |
define('POLYLANG_DIR', dirname(__FILE__)); // our directory
|
49 |
if (!defined('PLL_COOKIE'))
|
50 |
define('PLL_COOKIE', 'pll_language'); // cookie name. no cookie will be used if set to false
|
51 |
|
52 |
+
if (!defined('PLL_SEARCH_FORM_JS') && !version_compare($GLOBALS['wp_version'], '3.6', '<'))
|
53 |
define('PLL_SEARCH_FORM_JS', false); // the search form js is no more needed in WP 3.6+ except if the search form is hardcoded elsewhere than in searchform.php
|
54 |
|
55 |
require_once(PLL_INC.'/base.php');
|
72 |
}
|
73 |
|
74 |
// stopping here if we are going to deactivate the plugin (avoids breaking rewrite rules)
|
75 |
+
if (isset($_GET['action'], $_GET['plugin']) && $_GET['action'] == 'deactivate' && $_GET['plugin'] == 'polylang/polylang.php')
|
76 |
return;
|
77 |
|
78 |
// blog creation on multisite
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, i18n, international, l10n, localization
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.6
|
7 |
-
Stable tag: 1.1
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
@@ -92,6 +92,24 @@ If you are using a version older than 0.8, please ugrade to 0.9.8 before ugradin
|
|
92 |
|
93 |
== Changelog ==
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
= 1.1 (2013-05-10) =
|
96 |
|
97 |
* When adding the language to all urls, the language is now defined in (plugins_loaded, 1) for better compatibility with some plugins (WordPress SEO)
|
@@ -104,7 +122,7 @@ If you are using a version older than 0.8, please ugrade to 0.9.8 before ugradin
|
|
104 |
* Posts or terms created from frontend are now assigned the current language (or another one if specified in the variable 'lang')
|
105 |
* Bug correction: continents-cities-xx_XX.mo not downloaded
|
106 |
* Bug correction: a gzipped 404 page is downloaded when a mo file does not exist on WordPress languages files repository
|
107 |
-
* Bug correction: post_date_gmt not synchronized together with post_date
|
108 |
* Tests done with WP 3.6 beta 2 and Twenty thirteen
|
109 |
|
110 |
See changelog.txt for full changelog
|
4 |
Tags: multilingual, bilingual, translate, translation, language, multilanguage, i18n, international, l10n, localization
|
5 |
Requires at least: 3.1
|
6 |
Tested up to: 3.6
|
7 |
+
Stable tag: 1.1.1
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Polylang adds multilingual content management support to WordPress.
|
92 |
|
93 |
== Changelog ==
|
94 |
|
95 |
+
= 1.1.1 (2013-05-20) =
|
96 |
+
|
97 |
+
* Move nav menu language switcher split from 'wp_nav_menu_objects' to 'wp_get_nav_menu_items' filter
|
98 |
+
* Add the filter 'pll_redirect_home'
|
99 |
+
* Automatically translate ids in 'include' argument of 'get_terms' (useful for the menus in the Suffusion theme)
|
100 |
+
* Add compatibility with Jetpack infinite scroll
|
101 |
+
* Bug correction: rtl text direction not set when adding the language code to all urls (introduced in 1.1)
|
102 |
+
* Bug correction: hide again navigation panel in theme customizer as it still doesn't work
|
103 |
+
* Bug correction: is_home not set on translated page when searching an empty string
|
104 |
+
* Bug correction: fatal error when creating a post or term from frontend (introduced in 1.1)
|
105 |
+
* Bug correction: attachments may load a wrong language when media translation was enabled then disabled
|
106 |
+
* Bug correction: warning when querying posts before the action 'wp_loaded' has been fired (in auto-translate.php)
|
107 |
+
* Bug correction: potential issue if other plugins use the filter 'get_nav_menu'
|
108 |
+
* Bug correction: interference between language inline edit and search in admin list tables
|
109 |
+
* Bug correction: auto-translate breaks queries tax_query when the 'field' is set to 'id'
|
110 |
+
* Bug correction: search is not filtered by language for default permalinks (introduced in 1.1)
|
111 |
+
* Tests done with WP 3.6 beta 3 and Twenty thirteen
|
112 |
+
|
113 |
= 1.1 (2013-05-10) =
|
114 |
|
115 |
* When adding the language to all urls, the language is now defined in (plugins_loaded, 1) for better compatibility with some plugins (WordPress SEO)
|
122 |
* Posts or terms created from frontend are now assigned the current language (or another one if specified in the variable 'lang')
|
123 |
* Bug correction: continents-cities-xx_XX.mo not downloaded
|
124 |
* Bug correction: a gzipped 404 page is downloaded when a mo file does not exist on WordPress languages files repository
|
125 |
+
* Bug correction: post_date_gmt not synchronized together with post_date
|
126 |
* Tests done with WP 3.6 beta 2 and Twenty thirteen
|
127 |
|
128 |
See changelog.txt for full changelog
|