From cc4f66f13f7e0ffd3876cac68e8ff3f2269e645d Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 2 Jun 2009 00:27:53 +0000 Subject: [PATCH] Allow translators to change the curly quotes in wptexturize(), props nbachiyski fixes #10001 git-svn-id: https://develop.svn.wordpress.org/trunk@11504 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 6c363bab2e..cb324f35d5 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -32,6 +32,12 @@ function wptexturize($text) { $curl = ''; $textarr = preg_split('/(<.*>|\[.*\])/Us', $text, -1, PREG_SPLIT_DELIM_CAPTURE); $stop = count($textarr); + + /* translators: opening curly quote */ + $opening_quote = _x('“', 'opening curly quote'); + /* translators: closing curly quote */ + $closing_quote = _x('”', 'closing curly quote'); + $no_texturize_tags = apply_filters('no_texturize_tags', array('pre', 'code', 'kbd', 'style', 'script', 'tt')); $no_texturize_shortcodes = apply_filters('no_texturize_shortcodes', array('code')); $no_texturize_tags_stack = array(); @@ -47,10 +53,10 @@ function wptexturize($text) { } $static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'s', '\'\'', ' (tm)'), $cockney); - $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', '“', '’s', '”', ' ™'), $cockneyreplace); + $static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, '’s', $closing_quote, ' ™'), $cockneyreplace); $dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/(\s|\A|")\'/', '/(\d+)"/', '/(\d+)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A)"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/(\d+)x(\d+)/'); - $dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1“$2', '”$1', '’$1', '$1×$2'); + $dynamic_replacements = array('’$1','$1‘', '$1″', '$1′', '$1’$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '’$1', '$1×$2'); for ( $i = 0; $i < $stop; $i++ ) { $curl = $textarr[$i];