WordPress.org

Plugin Directory

Changeset 612378


Ignore:
Timestamp:
10/14/12 19:38:32 (18 months ago)
Author:
Chouby
Message:

Belarusian translation and bug corrections

Location:
polylang/trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • polylang/trunk/include/admin-filters.php

    r609205 r612378  
    77 
    88        // additionnal filters and actions 
    9         add_action('admin_init',  array(&$this, 'admin_init')); 
     9        add_action('admin_init', array(&$this, 'admin_init')); 
    1010 
    1111        // remove the customize menu section as it is unusable with Polylang 
     
    3030        // add the language and translations columns in 'All Posts', 'All Pages' and 'Media library' panels 
    3131        foreach (PLL_MEDIA_SUPPORT ? array('posts', 'pages', 'media') : array('posts', 'pages') as $type) { 
    32             add_filter('manage_'.$type.'_columns',  array(&$this, 'add_post_column'), 10, 2); 
    33         add_action('manage_'.$type.'_custom_column', array(&$this, 'post_column'), 10, 2); 
     32            add_filter('manage_'.$type.'_columns', array(&$this, 'add_post_column'), 10, 2); 
     33            add_action('manage_'.$type.'_custom_column', array(&$this, 'post_column'), 10, 2); 
    3434        } 
    3535 
     
    8080        foreach ($this->taxonomies as $tax) { 
    8181            // adds the language field in the 'Categories' and 'Post Tags' panels 
    82             add_action($tax.'_add_form_fields',  array(&$this, 'add_term_form')); 
     82            add_action($tax.'_add_form_fields', array(&$this, 'add_term_form')); 
    8383 
    8484            // adds the language field and translations tables in the 'Edit Category' and 'Edit Tag' panels 
    85             add_action($tax.'_edit_form_fields',  array(&$this, 'edit_term_form')); 
     85            add_action($tax.'_edit_form_fields', array(&$this, 'edit_term_form')); 
    8686 
    8787            // adds the language column in the 'Categories' and 'Post Tags' tables 
    8888            add_filter('manage_edit-'.$tax.'_columns', array(&$this, 'add_term_column')); 
    89           add_action('manage_'.$tax.'_custom_column', array(&$this, 'term_column'), 10, 3); 
     89            add_action('manage_'.$tax.'_custom_column', array(&$this, 'term_column'), 10, 3); 
    9090 
    9191            // adds action related to languages when deleting categories and post tags 
     
    100100        // ajax response for edit term form 
    101101        add_action('wp_ajax_term_lang_choice', array(&$this,'term_lang_choice')); 
     102 
     103        // filter _wp_auto_add_pages_to_menu by language 
     104        add_action('transition_post_status', array(&$this, 'auto_add_pages_to_menu'), 5, 3); // before _wp_auto_add_pages_to_menu 
    102105 
    103106        // modifies the theme location nav menu metabox 
     
    160163        $language = $this->get_language(substr($column, 9)); 
    161164 
    162         // hidden field containing the post language for quick edit  
     165        // hidden field containing the post language for quick edit 
    163166        if ($column == $this->get_first_language_column()) 
    164167            printf('<input type="hidden" name="lang_%d" value="%s" />', $post_id, $lang->slug); 
    165168 
    166169        // link to edit post (or a translation) 
    167         if ($id = $this->get_post($post_id, $language))  
     170        if ($id = $this->get_post($post_id, $language)) 
    168171            printf('<a class="%1$s" title="%2$s" href="%3$s"></a>', 
    169172                $id == $post_id ? 'pll_icon_tick' : 'pll_icon_edit', 
     
    201204    // filters posts, pages and media by language 
    202205    function parse_query($query) { 
    203     $qvars = &$query->query_vars; 
     206        $qvars = &$query->query_vars; 
    204207 
    205208        // do not filter post types such as nav_menu_item 
    206209        if (isset($qvars['post_type']) && !in_array($qvars['post_type'], $this->post_types)) { 
    207210            if (isset($qvars['lang'])) 
    208                 unset ($qvars['lang']);              
     211                unset ($qvars['lang']); 
    209212            return $query; 
    210213        } 
    211214 
    212215        // filters the list of media by language when uploading from post 
    213     if ($GLOBALS['pagenow'] == 'media-upload.php' && isset($_GET['post_id']) && $lang = $this->get_post_language($_GET['post_id'])) 
     216        if ($GLOBALS['pagenow'] == 'media-upload.php' && isset($_GET['post_id']) && $lang = $this->get_post_language($_GET['post_id'])) 
    214217            $query->set('lang', $lang->slug); 
    215218 
     
    217220            $qvars['lang'] = $lg; 
    218221 
    219         if (isset($qvars['lang']) &&  $qvars['lang'] == 'all') 
     222        if (isset($qvars['lang']) && $qvars['lang'] == 'all') 
    220223            unset ($qvars['lang']); 
    221224 
     
    244247 
    245248        $lang = ($lg = $this->get_post_language($post_ID)) ? $lg : 
    246             (isset($_GET['new_lang']) ?  $this->get_language($_GET['new_lang']) : 
     249            (isset($_GET['new_lang']) ? $this->get_language($_GET['new_lang']) : 
    247250            $this->get_default_language()); 
    248251 
     
    544547            'label' => __('Language', 'polylang'), 
    545548            'input' => 'html', 
    546             'html'  => $this->dropdown_languages(array('name' => "attachments[$post_id][language]", 'class' => "media_lang_choice", 'selected' => $lang ? $lang->slug : '')) 
     549            'html'  => $this->dropdown_languages(array( 
     550                'name'     => "attachments[$post_id][language]", 
     551                'class'    => "media_lang_choice", 
     552                'selected' => $lang ? $lang->slug : '' 
     553            )) 
    547554        ); 
    548555 
     
    594601        $post_id = $post->ID; 
    595602 
    596         $post->ID = null; // to create a new attachment 
    597         $post->post_parent = ($post->post_parent && $tr_parent = $this->get_translation('post', $post->post_parent, $_GET['new_lang'])) ? $tr_parent : 0; // translates attachment parent if exists 
     603        // create a new attachment (translate attachment parent if exists) 
     604        $post->ID = null; // will force the creation 
     605        $post->post_parent = ($post->post_parent && $tr_parent = $this->get_translation('post', $post->post_parent, $_GET['new_lang'])) ? $tr_parent : 0; 
    598606        $tr_id = wp_insert_attachment($post); 
    599607        add_post_meta($tr_id, '_wp_attachment_metadata', get_post_meta($post_id, '_wp_attachment_metadata', true)); 
     
    632640        global $wpdb; 
    633641        $uploadpath = wp_upload_dir(); 
    634         $ids = $wpdb->get_col($wpdb->prepare("SELECT `post_id` FROM $wpdb->postmeta WHERE `meta_key` = '_wp_attached_file' AND `meta_value` = '%s'", ltrim($file, $uploadpath['basedir']))); 
     642        $ids = $wpdb->get_col($wpdb->prepare( 
     643            "SELECT `post_id` FROM $wpdb->postmeta WHERE `meta_key` = '_wp_attached_file' AND `meta_value` = '%s'", 
     644            ltrim($file, $uploadpath['basedir']) 
     645        )); 
    635646 
    636647        if (!empty($ids)) { 
     
    745756    // adds the language column (before the posts column) in the 'Categories' or 'Post Tags' table 
    746757    function add_term_column($columns) { 
    747     return $this->add_column($columns, 'posts'); 
     758        return $this->add_column($columns, 'posts'); 
    748759    } 
    749760 
     
    797808            if ($this->get_term_language($term_id)->slug != $_POST['inline_lang_choice']) 
    798809                $this->delete_translation('term', $term_id); 
    799             $this->set_term_language($term_id, $_POST['inline_lang_choice']);  
     810            $this->set_term_language($term_id, $_POST['inline_lang_choice']); 
    800811        } 
    801812        elseif (isset($_POST['post_lang_choice'])) 
     
    923934    } 
    924935 
     936    // filter _wp_auto_add_pages_to_menu by language 
     937    function auto_add_pages_to_menu( $new_status, $old_status, $post ) { 
     938        if ('publish' != $new_status || 'publish' == $old_status || 'page' != $post->post_type || ! empty($post->post_parent)) 
     939            return; 
     940 
     941        // get all the menus in the post language 
     942        $menus = array(); 
     943        $lang = $this->get_post_language($post->ID); 
     944        $menu_lang = get_option('polylang_nav_menus'); 
     945        foreach ($menu_lang as $menu) { 
     946            if (isset($menu[$lang->slug])) 
     947                $menus[] = $menu[$lang->slug]; 
     948        } 
     949        $menus = implode(',', $menus); 
     950 
     951        add_filter('option_nav_menu_options', create_function('$a', "\$a['auto_add'] = array_intersect(\$a['auto_add'], array($menus)); return \$a;")); 
     952    } 
     953 
    925954    // modifies the theme location nav menu metabox 
    926955    // thanks to: http://wordpress.stackexchange.com/questions/2770/how-to-add-a-custom-metabox-to-the-menu-management-admin-screen 
     
    954983            __('The widget is displayed for:', 'polylang'), 
    955984            $this->dropdown_languages(array( 
    956                 'name'       => $widget->id.'_lang_choice', 
    957                 'class'      => 'tags-input', 
     985                'name'        => $widget->id.'_lang_choice', 
     986                'class'       => 'tags-input', 
    958987                'add_options' => array(array('value' => 0, 'text' => __('All languages', 'polylang'))), 
    959                 'selected'   => isset($widget_lang[$widget->id]) ? $widget_lang[$widget->id] : '' 
     988                'selected'    => isset($widget_lang[$widget->id]) ? $widget_lang[$widget->id] : '' 
    960989            )) 
    961990        ); 
     
    9821011            __('Admin language', 'polylang'), 
    9831012            $this->dropdown_languages(array( 
    984                 'name'       => 'user_lang', 
    985                 'value'      => 'description', 
    986                 'selected'   => get_user_meta($profileuser->ID, 'user_lang', true), 
     1013                'name'        => 'user_lang', 
     1014                'value'       => 'description', 
     1015                'selected'    => get_user_meta($profileuser->ID, 'user_lang', true), 
    9871016                'add_options' => array(array('value' => 0, 'text' => __('Wordpress default', 'polylang'))) 
    9881017            )) 
  • polylang/trunk/include/admin.php

    r608640 r612378  
    416416        $this->register_string(__('Site Title'), get_option('blogname')); 
    417417        $this->register_string(__('Tagline'), get_option('blogdescription')); 
     418        $this->register_string(__('Date Format'), get_option('date_format')); 
     419        $this->register_string(__('Time Format'), get_option('time_format')); 
    418420 
    419421        // widgets titles 
  • polylang/trunk/include/core.php

    r611088 r612378  
    114114 
    115115        // strings translation (must be applied before WordPress applies its default formatting filters) 
    116         add_filter('widget_title', 'pll__', 1); 
    117         add_filter('option_blogname', 'pll__', 1); 
    118         add_filter('option_blogdescription', 'pll__', 1); 
     116        foreach (array('widget_title', 'option_blogname', 'option_blogdescription', 'option_date_format', 'option_time_format') as $filter) 
     117            add_filter($filter, 'pll__', 1); 
    119118 
    120119        // translates biography 
  • polylang/trunk/include/languages.php

    r582359 r612378  
    77$languages = array( 
    88    array('ar', 'ar', 'العربية', 'rtl'), 
     9    array('be', 'be_BY', 'Беларуская мова'), 
    910    array('bg', 'bg_BG', 'български'), 
    1011    array('bs', 'bs_BA', 'Bosanski'), 
  • polylang/trunk/polylang.php

    r611088 r612378  
    33Plugin Name: Polylang 
    44Plugin URI: http://wordpress.org/extend/plugins/polylang/ 
    5 Version: 0.9.3.2 
     5Version: 0.9.3.4 
    66Author: F. Demarle 
    77Description: Adds multilingual capability to Wordpress 
     
    2525*/ 
    2626 
    27 define('POLYLANG_VERSION', '0.9.3.2'); 
     27define('POLYLANG_VERSION', '0.9.3.4'); 
    2828define('PLL_MIN_WP_VERSION', '3.1'); 
    2929 
  • polylang/trunk/readme.txt

    r611088 r612378  
    2222* As a bonus, each user can set the WordPress admin language in its profile 
    2323 
    24 The plugin admin interface is currently available in 17 languages: English, French, German contributed by [Christian Ries](http://www.singbyfoot.lu), Russian contributed by [yoyurec](http://yoyurec.in.ua), Greek contributed by [theodotos](http://www.ubuntucy.org), Dutch contributed by [AlbertGn](http://wordpress.org/support/profile/albertgn), Hebrew contributed by [ArielK](http://www.arielk.net), Polish contributed by [Peter Paciorkiewicz](http://www.paciorkiewicz.pl), Latvian contributed by [@AndyDeGroo](http://twitter.com/AndyDeGroo), Italian contributed by [Luca Barbetti](http://wordpress.org/support/profile/lucabarbetti), Danish contributed by [Compute](http://wordpress.org/support/profile/compute), Spanish contributed by Curro, Portuguese contributed by [Vitor Carvalho](http://vcarvalho.com/), Lithuanian contributed by [Naglis Jonaitis](http://najo.lt/), Turkish contributed by [darchws](http://darch.ws/), Finnish contributed by [Jani Alha](http://www.wysiwyg.fi), Bulgarian contributed by [pavelsof](http://wordpress.org/support/profile/pavelsof) 
     24The plugin admin interface is currently available in 18 languages: English, French, German contributed by [Christian Ries](http://www.singbyfoot.lu), Russian contributed by [yoyurec](http://yoyurec.in.ua), Greek contributed by [theodotos](http://www.ubuntucy.org), Dutch contributed by [AlbertGn](http://wordpress.org/support/profile/albertgn), Hebrew contributed by [ArielK](http://www.arielk.net), Polish contributed by [Peter Paciorkiewicz](http://www.paciorkiewicz.pl), Latvian contributed by [@AndyDeGroo](http://twitter.com/AndyDeGroo), Italian contributed by [Luca Barbetti](http://wordpress.org/support/profile/lucabarbetti), Danish contributed by [Compute](http://wordpress.org/support/profile/compute), Spanish contributed by Curro, Portuguese contributed by [Vitor Carvalho](http://vcarvalho.com/), Lithuanian contributed by [Naglis Jonaitis](http://najo.lt/), Turkish contributed by [darchws](http://darch.ws/), Finnish contributed by [Jani Alha](http://www.wysiwyg.fi), Bulgarian contributed by [pavelsof](http://wordpress.org/support/profile/pavelsof), Belarusian contributed by [Alexander Markevitch](http://fourfeathers.by/) 
    2525 
    2626 
     
    8181= Translate the admin interface = 
    8282 
    83 Polylang is already available in 17 languages. It's very easy to add a new one ! Download [poedit](http://www.poedit.net/download.php) (available for Windows, Mac OS X and Linux). Rename the file polylang.pot found in the polylang/languages directory into something like polylang-your_locale.po. Open the file with poedit and start translating (keeping strange codes such as %s, %1$s as is). Once done, just save and you will get two files polylang-your_locale.po and polylang-your_locale.mo that you can send to the author. The translation will be included with the next release. 
     83Polylang is already available in 18 languages. It's very easy to add a new one ! Download [poedit](http://www.poedit.net/download.php) (available for Windows, Mac OS X and Linux). Rename the file polylang.pot found in the polylang/languages directory into something like polylang-your_locale.po. Open the file with poedit and start translating (keeping strange codes such as %s, %1$s as is). Once done, just save and you will get two files polylang-your_locale.po and polylang-your_locale.mo that you can send to the author. The translation will be included with the next release. 
    8484 
    8585= Communicate = 
     
    9595= 0.9.4 = 
    9696 
    97 * Bug correction: some issues with string translations 
     97* Add Belarusian translation contributed by [Alexander Markevitch](http://fourfeathers.by/) 
     98* Add Belarusian (be_BY) to predefined languages list (automatic download and update of language files won't work) 
     99* Add the possibility to translate the date format and time format  
     100* Bug correction: still some issues with string translations 
    98101* Bug correction: search is not filtered by the (default) language when the language is set by content and the language code is hidden for the default language 
    99 * Bug correction: post & page preview urls are broken when adding the language code to all urls  
     102* Bug correction: posts & pages preview urls are broken when adding the language code to all urls 
     103* Bug coorection: automatically added new top-level pages to menus are not filtered by language 
    100104 
    101105= 0.9.3 (2012-10-08) = 
Note: See TracChangeset for help on using the changeset viewer.