Make WordPress Core

Opened 2 months ago

Last modified 8 weeks ago

#49690 new defect (bug)

Reconsider ja_JP usage in Tests_DB::test_locale_floats()

Reported by: SergeyBiryukov Owned by:
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.1
Component: Database Keywords:
Focuses: Cc:


Background: [746/tests], [747/tests], #19861.

Tests_DB::test_locale_floats() ensures that floats formatted as 0,700 get sanitized properly by wpdb.

This is relevant for locales using comma as a decimal separator: ru_RU, fr_FR, de_DE, es_ES, and others.

[43359] / #43829 added ja_JP to the list. Per Wikipedia, Japan uses a dot, not a comma, as a decimal separator, so adding it here doesn't seem to serve any purpose and might cause some confusion.

Change History (2)

#1 @johnjamesjacoby
2 months ago

If I understand correctly, the goal with #43829 was to make multibyte testing easier, not necessarily intentionally related to locale specific formatting.

Are there float tests that are inadvertently failing when testing with ja_JP?

#2 @gh640
8 weeks ago

Are there float tests that are inadvertently failing when testing with ja_JP?

I'm not sure if there are failing tests but I think it doesn't make sense to use the locale ja_JP in Tests_DB::test_locale_floats(). Because Japan uses a dot as a decimal separator as mentioned. (I'm Japanese.)

Concretely, if $flag is set to ja_JP.utf8 or ja_JP in the following lines, it's better to skip the test with the message "No European languages available for testing" rather than to pass the test using the selected locale, I think.

    // Switch to Russian.
    $flag = setlocale( LC_ALL, 'ru_RU.utf8', 'rus', 'fr_FR.utf8', 'fr_FR', 'de_DE.utf8', 'de_DE', 'es_ES.utf8', 'es_ES', 'ja_JP.utf8', 'ja_JP' );
    if ( false === $flag ) {
      $this->markTestSkipped( 'No European languages available for testing' );

So I think it's better to remove ja_JP.utf8 and ja_JP from there as proposed.

Note: See TracTickets for help on using tickets.