[wp-trac] [WordPress Trac] #47511: Add specific "default settings" for different locales

WordPress Trac noreply at wordpress.org
Sun Jun 9 18:29:44 UTC 2019


#47511: Add specific "default settings" for different locales
-------------------------+-----------------------------
 Reporter:  azaozz       |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  I18N         |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+-----------------------------

Comment (by azaozz):

 Replying to [comment:4 swissspidy]:

 > thereā€˜d be a long list of defaults for every locale...

 Don't think it will be long, maybe just for few locales :)

 The way I see it is to have the "current defaults" in an array, and then
 override only what's needed/different for each locale. For several locales
 we won't need to change anything, and for most we will only change 1-2
 things (as far as I see). Then wrap this into a function similar to
 `get_bloginfo()` which will make these settings filterable and easy to use
 (of course all of this will be in `WP_Locale`).

 This would be much better/easier than the current things like:
 {{{
      /* translators: localized date format, see
 https://secure.php.net/date */
      __( 'F j, Y' );
      /* translators: localized time format, see
 https://secure.php.net/date */
      __( 'g:i a' );
      ...
 }}}

 Or even this:
 {{{
 // Set text direction.
 ...
 /* translators: 'rtl' or 'ltr'. This sets the text direction for
 WordPress. */
 } elseif ( 'rtl' == _x( 'ltr', 'text direction' ) ) {
         $this->text_direction = 'rtl';
 }
 }}}

 (The list of RTL languages/locales is well known, we shouldn't push that
 to the translators to set).

 In addition this will let us return the proper type (string vs. int) and
 sanitize things that may need it.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47511#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list