[wp-trac] [WordPress Trac] #36859: Patch to allow the current locale to be changed on the fly including fetching missing language files

WordPress Trac noreply at wordpress.org
Tue May 17 11:52:56 UTC 2016


#36859: Patch to allow the current locale to be changed on the fly including
fetching missing language files
--------------------------------------+----------------------
 Reporter:  pbearne                   |       Owner:
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:
Component:  I18N                      |     Version:
 Severity:  normal                    |  Resolution:  wontfix
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+----------------------

Comment (by pbearne):

 the reason we wrote this was we were trying to write Unit test like this

 {{{#!php
 <?php
         function test_number_format_i18n_custom_separator() {
                 global $wp_locale;
                 $wp_locale->number_format['decimal_point'] = '@';
                 $wp_locale->number_format['thousands_sep'] = '^';

                 $this->assertEquals( '1^000 at 00', number_format_i18n(
 1000.00, 2 ) );
                 $this->assertEquals( '1^000 at 00', number_format_i18n(
 (int)1000, 2 ) );
                 $this->assertEquals( '1^234^567^890 at 00000',
 number_format_i18n( 1234567890.00, 5 ) );
                 $this->assertEquals( '1^234^567^890 at 99999',
 number_format_i18n( 1234567890.99999, 5 ) );
                 $this->assertEquals( '1^234^567^890 at 50000',
 number_format_i18n( 1234567890.5, 5 ) );
                 // clear $wp_locale
                 $wp_locale = null;
         }
 }}}

 and have no way to swap the locale other than just setting it which feels
 wrong

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


More information about the wp-trac mailing list