[wp-trac] [WordPress Trac] #32555: TinyMCE should have a lang attribute

WordPress Trac noreply at wordpress.org
Thu Jul 16 15:10:39 UTC 2015


#32555: TinyMCE should have a lang attribute
-------------------------+-----------------------------
 Reporter:  GregLone     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  TinyMCE      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  administration
-------------------------+-----------------------------

Comment (by GregLone):

 It should be the same, indeed.
 At least until we can change the language in the administration area.

 So, I was just thinking, perhaps we should try to be forward-compatible:
 Some JavaScript variables are printed in `admin-header.php`:

 {{{
 var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
         pagenow = '<?php echo $current_screen->id; ?>',
         typenow = '<?php echo $current_screen->post_type; ?>',
         adminpage = '<?php echo $admin_body_class; ?>',
         thousandsSeparator = '<?php echo addslashes(
 $wp_locale->number_format['thousands_sep'] ); ?>',
         decimalPoint = '<?php echo addslashes(
 $wp_locale->number_format['decimal_point'] ); ?>',
         isRtl = <?php echo (int) is_rtl(); ?>;
 }}}

 Perhaps we could add a `locale` variable (fr_FR) and a `language` variable
 (fr-FR)?

 {{{
         locale = '<?php echo apply_filters( 'content_locale', get_locale()
 ); ?>',
         language = '<?php echo apply_filters( 'content_language',
 get_bloginfo( 'language' ) ); ?>',
 }}}

 In this case, the MCE plugin is a bit simpler:

 {{{
 tinymce.PluginManager.add( "langattribute", function( editor ) {
         editor.on( "init", function() {
                 editor.getBody().setAttribute( "lang", window.language );
         } );
 } );
 }}}

 I guess we'll still need some changes if some day we can have a different
 language in the administration area (can't find the related ticket) but
 it's start.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32555#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list