• A. I would like the interface to be in the translated language while editing each page version.
    B. When translating a website to RTL language the editor must be RTL too. Now it is always LTR.
    I do not want to change the whole admin to the RTL language, because it will harm the original English editing (main language).

    Thanks,
    Ronny

    http://wordpress.org/plugins/polylang/

Viewing 1 replies (of 1 total)
  • Thread Starter Ronny Sherer

    (@ronshe)

    I finally found two solutions to change the CSS of the editor.
    Add class RTL and rely on editor-style.css to support it (Twenty Thirteen does).

    function polylang_tinymce_settings($settings)
    {
    	global $post, $polylang;
    	$language = $polylang->model->get_post_language($post->ID);
    	if ($language->is_rtl)
    		$settings['body_class'] .= ' rtl';
        return $settings;
    }
    add_filter('tiny_mce_before_init','polylang_tinymce_settings');

    Add CSS file to support the RTL:

    function my_editor_style($url)
    {
    	global $post, $polylang;
    	$language = $polylang->model->get_post_language($post->ID);
    	if ($language->is_rtl)
    	{
    		if ( !empty($url) )
    			$url .= ',';
    
    		// Change the path here if using sub-directory
    		$url .= trailingslashit( get_stylesheet_directory_uri() ) . 'editor-style-rtl.css';
    	}
    
    	return $url;
    }
    add_filter('mce_css', 'my_editor_style');

Viewing 1 replies (of 1 total)
  • The topic ‘Editor language and direction’ is closed to new replies.