Make WordPress Core

Changeset 38646


Ignore:
Timestamp:
09/23/2016 12:06:24 AM (8 years ago)
Author:
SergeyBiryukov
Message:

I18N: Add support for Serbian crossed D in remove_accents().

Props Krstarica for the report.
Fixes #38078.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r38593 r38646  
    14911491 * | U+00B7   | l·l   | ll          | Flown dot (between two Ls)              |
    14921492 *
     1493 * Serbian (`sr_RS`) locale:
     1494 *
     1495 * |   Code   | Glyph | Replacement |               Description               |
     1496 * | -------- | ----- | ----------- | --------------------------------------- |
     1497 * | U+0110   | Đ     | DJ          | Latin capital letter D with stroke      |
     1498 * | U+0111   | đ     | dj          | Latin small letter d with stroke        |
     1499 *
    14931500 * @since 1.2.1
    14941501 * @since 4.6.0 Added locale support for `de_CH`, `de_CH_informal`, and `ca`.
     1502 * @since 4.7.0 Added locale support for `sr_RS`.
    14951503 *
    14961504 * @param string $string Text that might have accent characters
     
    16981706        } elseif ( 'ca' === $locale ) {
    16991707            $chars[ 'l·l' ] = 'll';
     1708        } elseif ( 'sr_RS' === $locale ) {
     1709            $chars[ 'Đ' ] = 'DJ';
     1710            $chars[ 'đ' ] = 'dj';
    17001711        }
    17011712
  • trunk/tests/phpunit/tests/formatting/RemoveAccents.php

    r38193 r38646  
    116116
    117117    /**
    118     * @ticket 37086
    119     */
     118     * @ticket 37086
     119     */
    120120    public function test_remove_catalan_middot() {
    121121        add_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
     
    127127        $this->assertEquals( 'al·lallalla', remove_accents( 'al·lallaŀla' ) );
    128128    }
     129
     130    public function _set_locale_to_serbian() {
     131        return 'sr_RS';
     132    }
     133
     134    /**
     135     * @ticket 38078
     136     */
     137    public function test_transcribe_serbian_crossed_d() {
     138        add_filter( 'locale', array( $this, '_set_locale_to_serbian' ) );
     139
     140        $this->assertEquals( 'DJdj', remove_accents( 'Đđ' ) );
     141       
     142        remove_filter( 'locale', array( $this, '_set_locale_to_serbian' ) );
     143       
     144        $this->assertEquals( 'Dd', remove_accents( 'Đđ' ) );
     145    }
    129146}
Note: See TracChangeset for help on using the changeset viewer.