[wp-trac] [WordPress Trac] #7164: Automatic text replacements should be localized

WordPress Trac wp-trac at lists.automattic.com
Sat Jun 21 01:49:46 GMT 2008


#7164: Automatic text replacements should be localized
-------------------------+--------------------------------------------------
 Reporter:  nico.r       |       Owner:  anonymous                   
     Type:  enhancement  |      Status:  new                         
 Priority:  low          |   Milestone:                              
Component:  i18n         |     Version:                              
 Severity:  minor        |    Keywords:  has-patch tested wptexturize
-------------------------+--------------------------------------------------
 In {{{wp-includes/formatting.php}}}, function {{{wptexturize(string)}}}
 does some text replacing, like replacement of straight quotes
 ({{{U+0022}}}) into curly quotes ({{{U+201C}}} and {{{U+201D}}}), but the
 replacements are specific to the {{{en_US}}} locale. For example, the
 correct quotation marks in {{{de_DE}}} are U+201E and U+201C.

 As the replacement arrays can AFAIK not be expressed (or only with
 difficulties) in PO translation files, there is some need for providing a
 means of adding a language-specific script file.

 Attached patch adds a function {{{get_lang_php()}}} to {{{wp-
 includes/l10n.php}}} which returns the name of a locale-specific PHP
 script. This new function is used in {{{wp-includes/formatting.php}}} in
 order to retrieve the script name; then this script is included.

 The patch also adds two locale-specific script files, one for {{{en_US}}},
 and one for {{{de_DE}}}. The {{{en_US}}} file simply contains the
 replacement patterns and strings which are currently present in {{{wp-
 includes/formatting.php}}} (they are moved by the patch). The {{{de_DE}}}
 file contains almost the same arrays, but adapted a little bit for German.
 Please note that the directory {{{wp-content/languages/}}}, in which these
 two files are placed, is currently not present on the trunk in the
 WordPress SVN repository.

 It is expected that translators are going to provide language-specific PHP
 scripts, or (if they do not know PHP scripting or regular expressions)
 information about what replacements should be included in these, so that
 developers can add the appropriate regular expressions and replacement
 texts.

 It is further expected that the new {{{get_lang_php()}}} mechanism will be
 used in other parts of the WordPress code or by new code parts or modules.
 It is useful in all cases in which locale-specific scripting is needed
 (i.e. when things cannot be expressed in PO translation files).

 The patch applies to {{{r8152}}} (current {{{HEAD}}} of {{{trunk}}}) in
 the WordPress SVN repository.
 The function comment for {{{get_lang_php()}}} in {{{wp-
 includes/l10n.php}}} should be changed (fix “{{{@since}}}” comment) before
 the file is committed.

 Attached patch is currently running on a production system with WordPress
 2.5.1.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7164>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list