[wp-trac] [WordPress Trac] #28502: 'User deleted' message needs context
noreply at wordpress.org
Tue Mar 31 15:49:17 UTC 2015
#28502: 'User deleted' message needs context
Reporter: extendwings | Owner: SergeyBiryukov
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 4.2
Component: I18N | Version: 3.9.1
Severity: normal | Resolution:
Keywords: has-patch commit | Focuses: administration, multisite
Comment (by SergeyBiryukov):
Basically, `_n()` should only be used for the same string with different
numbers, not for different strings.
`_n( '%d item', '%d items', $number )` is correct. `_n( 'One item', '%d
items', $number )` is *kinda* correct, but there are some issues:
* `'One item'` is not guaranteed to be used for exactly one item, but we
treat it like it is.
* We could translate it to `'%d item'`, but in some cases it's just not
* `'%s post not updated, somebody is editing it'` requires a different
translation in Slavic languages for when used for 1 vs. 21, it can't be
the same string.
* It also doesn't work for `'You have specified this user for
deletion:'`, `'Delete Theme'`, etc.
* It's more user-friendly to see `'Theme deleted'` for non-bulk actions
than `'1 theme deleted'`.
* It causes string conflicts, see #16130 and this ticket.
* As noted above, GlotPress gives you a warning about placeholders
So the fix is to make sure `'One item'` is only used for exactly one item,
not for 21 or 31, etc. You don't often delete exactly 21 users or update
21 posts, but when you do, you should see the correct string :)
The patch introduces this fix as a consistent pattern. I went through all
the strings and patched those where the first form is different from the
additional fourth form I [comment:5 added with Poedit years ago]. This
should allow me to ditch that fourth form and use GlotPress.
I just looked through all the changes again, and the only string that I
wouldn't mind to remove is the one in `wp-admin/network.php`
(authentication keys), since we know we're dealing with values less than
10 there. I've just included it for the sake of consistency.
Overall it's not that many changed strings, ~20 or so. Each new release
generally has more than a hundred.
Replying to [comment:22 ocean90]:
> Example: `sprintf( _n( 'Theme enabled.', '%s themes enabled.',
$_GET['enabled'] ), number_format_i18n( $_GET['enabled'] ) )`
> This looks valid since translators can/should translate `Theme enabled.`
as `%s theme enabled.`, if the singular string is used for other numbers.
I don't agree :) If you're not performing a bulk action, it's more user-
friendly to see `'Theme enabled'` than `'1 theme enabled'`. I'd like to
keep the strings as close to the originals as possible, without redundant
> I also want to propose a change to strings like `_n( 'Yes, Delete this
theme', 'Yes, Delete these themes', $themes_to_delete )`.
> When ever we use `_n()` we should pass the number too, even it's not
used in the English string:
> `sprintf( __( 'Yes, Delete this theme', 'Yes, Delete these themes',
$themes_to_delete ), number_format_i18n( $themes_to_delete )`. This will
allow translators to change the strings based on there plural rules.
Initially I thought that might help, but actually it wouldn't. It means we
would have to include additional number in all the strings on that screen:
* `'Delete Theme'` => `'Delete %d Theme'`
* `'This theme may be active on other sites in the network.'` => `'This %d
theme may be active on other sites in the network.'`
* `'You are about to remove the following theme:'` => `'You are about to
remove the following %d theme:'`
* `'Are you sure you wish to delete this theme?'` => `'Are you sure you
wish to delete %d theme?'`
* `'Yes, Delete this theme'` => `'Yes, Delete %d theme'`
As noted above, including additional numbers like that is redundant and
not user-friendly, and I'd like to avoid that. [attachment:28502.3.diff]
solves this in a more appropriate way.
Ticket URL: <https://core.trac.wordpress.org/ticket/28502#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac