I18N: Add support for the Catalan flown dot in `remove_accents()`.

Props xavivars, SergeyBiryukov.
Fixes #37086.

git-svn-id: https://develop.svn.wordpress.org/trunk@37853 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-06-23 13:27:32 +00:00
parent f78e4becba
commit a35a1a9c75
2 changed files with 25 additions and 1 deletions

View File

@ -1484,8 +1484,14 @@ function utf8_uri_encode( $utf8_string, $length = 0 ) {
* | U+00C5 | Å | Aa | Latin capital letter A with ring above | * | U+00C5 | Å | Aa | Latin capital letter A with ring above |
* | U+00E5 | å | aa | Latin small letter a with ring above | * | U+00E5 | å | aa | Latin small letter a with ring above |
* *
* Catalan (`ca`) locale:
*
* | Code | Glyph | Replacement | Description |
* | -------- | ----- | ----------- | --------------------------------------- |
* | U+00B7 | l·l | ll | Flown dot (between two Ls) |
*
* @since 1.2.1 * @since 1.2.1
* @since 4.6.0 Locale support was added for `de_CH` and `de_CH_informal`. * @since 4.6.0 Locale support was added for `de_CH`, `de_CH_informal`, and `ca`.
* *
* @param string $string Text that might have accent characters * @param string $string Text that might have accent characters
* @return string Filtered string with replaced "nice" characters. * @return string Filtered string with replaced "nice" characters.
@ -1689,6 +1695,8 @@ function remove_accents( $string ) {
$chars[ chr(195).chr(184) ] = 'oe'; $chars[ chr(195).chr(184) ] = 'oe';
$chars[ chr(195).chr(133) ] = 'Aa'; $chars[ chr(195).chr(133) ] = 'Aa';
$chars[ chr(195).chr(165) ] = 'aa'; $chars[ chr(195).chr(165) ] = 'aa';
} elseif ( 'ca' === $locale ) {
$chars[ chr(108).chr(194).chr(183).chr(108) ] = 'll';
} }
$string = strtr($string, $chars); $string = strtr($string, $chars);

View File

@ -110,4 +110,20 @@ class Tests_Formatting_RemoveAccents extends WP_UnitTestCase {
remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) ); remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
} }
public function _set_locale_to_catalan() {
return 'ca';
}
/**
* @ticket 37086
*/
public function test_remove_catalan_middot() {
add_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
$this->assertEquals( 'allallalla', remove_accents( 'al·lallaŀla' ) );
remove_filter( 'locale', array( $this, '_set_locale_to_catalan' ) );
$this->assertEquals( 'al·lallalla', remove_accents( 'al·lallaŀla' ) );
}
} }