Make WordPress Core

Ticket #23907: 23907.5.diff

File 23907.5.diff, 2.7 KB (added by atimmer, 11 years ago)
  • src/wp-includes/formatting.php

     
    798798                        $chars[ chr(195).chr(156) ] = 'Ue';
    799799                        $chars[ chr(195).chr(188) ] = 'ue';
    800800                        $chars[ chr(195).chr(159) ] = 'ss';
     801                 }
     802
     803                if ( 'da_DK' === $locale || 'sv_SE' === $locale || 'nb_NO' === $locale || 'nn_NO' === $locale ) {
     804                        $chars[ chr(195).chr(134) ] = 'Ae';
     805                        $chars[ chr(195).chr(166) ] = 'ae';
     806                        $chars[ chr(195).chr(152) ] = 'Oe';
     807                        $chars[ chr(195).chr(184) ] = 'oe';
     808                        $chars[ chr(195).chr(133) ] = 'Aa';
     809                        $chars[ chr(195).chr(165) ] = 'aa';
    801810                }
    802811
    803812                $string = strtr($string, $chars);
  • tests/phpunit/tests/formatting/RemoveAccents.php

     
    9494
    9595                remove_filter( 'locale', array( $this, '_remove_accents_germanic_umlauts_cb' ) );
    9696        }
     97       
     98        public function _set_locale_to_danish() {
     99                return 'da_DK';
     100        }
     101       
     102        /**
     103         * @ticket 23907
     104         */
     105        public function test_remove_danish_accents() {
     106                add_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
     107               
     108                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     109               
     110                remove_filter( 'locale', array( $this, '_set_locale_to_danish' ) );
     111        }
     112       
     113        public function _set_locale_to_swedish() {
     114                return 'sv_SE';
     115        }
     116       
     117        /**
     118         * @ticket 23907
     119         */
     120        public function test_remove_swedish_accents() {
     121                add_filter( 'locale', array( $this, '_set_locale_to_swedish' ) );
     122               
     123                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     124               
     125                remove_filter( 'locale', array( $this, '_set_locale_to_swedish' ) );
     126        }
     127       
     128        public function _set_locale_to_norwegian_bokmaal() {
     129                return 'nb_NO';
     130        }
     131       
     132        /**
     133         * @ticket 23907
     134         */
     135        public function test_remove_norwegian_bokmaal_accents() {
     136                add_filter( 'locale', array( $this, '_set_locale_to_norwegian_bokmaal' ) );
     137               
     138                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     139               
     140                remove_filter( 'locale', array( $this, '_set_locale_to_norwegian_bokmaal' ) );
     141        }
     142       
     143        public function _set_locale_to_norwegian_nynorsk() {
     144                return 'nn_NO';
     145        }
     146       
     147        /**
     148         * @ticket 23907
     149         */
     150        public function test_remove_norwegian_nynorsk_accents() {
     151                add_filter( 'locale', array( $this, '_set_locale_to_norwegian_nynorsk' ) );
     152               
     153                $this->assertEquals( 'AeOeAaaeoeaa', remove_accents( 'ÆØÅæøå' ) );
     154               
     155                remove_filter( 'locale', array( $this, '_set_locale_to_norwegian_nynorsk' ) );
     156        }
    97157}