Allow 'Cockney' filter to be translated.

Updates unit test.

Props miqrogroove.
Fixes #31953.


git-svn-id: https://develop.svn.wordpress.org/trunk@32788 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-06-16 00:45:49 +00:00
parent 7dd8a1364a
commit 40bb9aa3d9
2 changed files with 11 additions and 4 deletions

View File

@ -102,11 +102,16 @@ function wptexturize( $text, $reset = false ) {
if ( isset($wp_cockneyreplace) ) {
$cockney = array_keys( $wp_cockneyreplace );
$cockneyreplace = array_values( $wp_cockneyreplace );
} elseif ( "'" != $apos ) { // Only bother if we're doing a replacement.
$cockney = array( "'tain't", "'twere", "'twas", "'tis", "'twill", "'til", "'bout", "'nuff", "'round", "'cause", "'em" );
$cockneyreplace = array( $apos . "tain" . $apos . "t", $apos . "twere", $apos . "twas", $apos . "tis", $apos . "twill", $apos . "til", $apos . "bout", $apos . "nuff", $apos . "round", $apos . "cause", $apos . "em" );
} else {
$cockney = $cockneyreplace = array();
/* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
* for example... 'We do not have enough words yet' ... is a typical quoted phrase. But when we write
* lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
*/
$cockney = explode( ',', _x( "'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
'Comma-separated list of words to texturize in your language' ) );
$cockneyreplace = explode( ',', _x( '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em',
'Comma-separated list of replacement words in your language' ) );
}
$static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );

View File

@ -1529,6 +1529,8 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
case '”' : return '!closeq2!';
case '′' : return '!prime1!';
case '″' : return '!prime2!';
case '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em' :
return '!apos!tain!apos!t,!apos!twere,!apos!twas,!apos!tis,!apos!twill,!apos!til,!apos!bout,!apos!nuff,!apos!round,!apos!cause,!apos!em';
default : return $translations;
}
}