[wp-trac] [WordPress Trac] #28502: Context needed to distinguish

WordPress Trac noreply at wordpress.org
Tue Jun 24 02:47:28 UTC 2014


#28502: Context needed to distinguish
--------------------------+----------------------------------------
 Reporter:  extendwings   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.0
Component:  I18N          |     Version:  3.9.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  administration, multisite
--------------------------+----------------------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch needs-testing =>


Comment:

 I don't think adding a context is a correct solution here.

 According to
 [https://glotpress.trac.wordpress.org/browser/trunk/locales/locales.php?rev=931#L992
 GlotPress' locales.php] and
 [https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html
 gettext documentation], Japanese doesn't have a distinction between a
 singular and plural form.

 We have quite a few instances in core where singular and plural forms are
 different:
 {{{
 $message = sprintf( _n( 'User deleted.', '%s users deleted.',
 $delete_count ), number_format_i18n( $delete_count ) );
 }}}
 This doesn't seem like a valid use of `_n()`. `'User deleted.'` should be
 a separate string instead:
 {{{
 if ( $delete_count > 1 ) {
         $message = sprintf( _n( '%s user deleted.', '%s users deleted.',
 $delete_count ), number_format_i18n( $delete_count ) );
 } else {
         $message = __( 'User deleted.' );
 }
 }}}

 This causes problems in Russian too. We have
 [https://glotpress.trac.wordpress.org/browser/trunk/locales/locales.php?rev=931#L1465
 3 plural forms]. The first form is used not just for 1, but also for 21,
 31, 41, etc. 'User deleted' only makes sense for 1. For 21, 31, etc., the
 number should be included in the string, but it's still the first form.

 I tried to address this previously in comment:12:ticket:15920 and on
 [http://make.wordpress.org/polyglots/2010/12/26/per-discussion-in-15920
 -ive-figured/ Polyglots], and ended up introducing a fourth plural form
 for Russian as a workaround. I managed to make it backwards compatible
 with the plural forms expression in GlotPress to import translations there
 (only the first three forms were imported), but still had to use Poedit to
 edit files and SVN to build packages.

 I think the correct solution here would be to review all these instances
 and separate single item strings from strings with numbers.

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


More information about the wp-trac mailing list