[wp-trac] [WordPress Trac] #51918: I18n - Application Passwords table dates
    WordPress Trac 
    noreply at wordpress.org
       
    Wed Dec  2 17:59:04 UTC 2020
    
    
  
#51918: I18n - Application Passwords table dates
-----------------------------------+---------------------
 Reporter:  pedromendonca          |       Owner:  (none)
     Type:  defect (bug)           |      Status:  new
 Priority:  normal                 |   Milestone:  5.6
Component:  Application Passwords  |     Version:  5.6
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch              |     Focuses:
-----------------------------------+---------------------
Comment (by TimothyBlynJacobs):
 Ah my mistake, thanks @ocean90!
 @pedromendonca Interesting. This is what I get when I saved that date
 format.
 {{{
 wp eval "echo esc_js( get_option( 'date_format' ) );"
 j de F, Y
 wp eval "echo esc_attr( get_option( 'date_format' ) );"
 j \d\e F, Y
 }}}
 Testing further, it seems like the backslashes need to be doubled when
 output. Replacing those lines with this seems to work for me:
 {{{
 esc_attr( str_replace( '\\', '\\\\', __( 'F j, Y' ) ) )
 }}}
 I'm testing with a filter in place to change the translation.
 {{{#!php
 <?php
 add_filter( 'gettext', function ( $translated, $text ) {
         if ( $text === 'F j, Y' ) {
                 $translated = 'j \d\e F, Y';
         }
         return $translated;
 }, 10, 2 );
 }}}
-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51918#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
    
    
More information about the wp-trac
mailing list