#19090 closed defect (bug) (fixed)

Write strings in numbered argument conversion specifications form for better understanding

Reported by: jiehanzheng Owned by: westi
Priority: normal Milestone: 3.3
Component: I18N Version: 3.3
Severity: normal Keywords: has-patch
Cc:

Description

Strings should be written in numbered argument conversion specifications from so that they can be translated into other languages like Chinese without sounding weird.

For example, we've got this string here http://core.trac.wordpress.org/browser/trunk/wp-admin/user-new.php#L75

$message = __("Hi,\n\nYou have been invited to join '%s' at\n%s with the role of %s.\nPlease click the following link to confirm the invite:\n%s\n");

The placeholders are all unnumbered, so I am unable to rearrange the arguments to make them sound better. Chinese translation requires get_option('blogname') to be the first, $_REQUEST[ 'role' ] as the second, then site_url(), and site_url("/newbloguser/$newuser_key/") as the last, which cannot be fulfilled with the current string.

Attachments (2)

19090.patch (1.0 KB) - added by SergeyBiryukov 19 months ago.
19090.2.patch (1.1 KB) - added by SergeyBiryukov 19 months ago.

Download all attachments as: .zip

Change History (9)

  • Component changed from Users to I18N
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.3
  • Severity changed from major to normal

19090.patch makes the string more consistent with the one in admin_created_user_email():
http://core.trac.wordpress.org/browser/trunk/wp-admin/user-new.php#L22

comment:2 follow-ups: ↓ 3 ↓ 4   duck_19 months ago

Surely the translation can just specify the placeholder/argument ordering as part of the translated string itself without the original string having to change?

If there's some reason this cannot be done I would've thought that most strings should specify ordering and that there would be a lot more instances of troublesome strings than just this one.

comment:3 in reply to: ↑ 2   jiehanzheng19 months ago

  • Severity changed from normal to trivial
  • Summary changed from Write strings in numbered argument conversion specifications form for translating to Write strings in numbered argument conversion specifications form for better understanding
  • Type changed from defect (bug) to enhancement

Replying to duck_:

Surely the translation can just specify the placeholder/argument ordering as part of the translated string itself without the original string having to change?

If there's some reason this cannot be done I would've thought that most strings should specify ordering and that there would be a lot more instances of troublesome strings than just this one.

It's a very reasonable point which I didn't think of... :(

I am changing the ticket properties now.

comment:4 in reply to: ↑ 2   westi19 months ago

  • Owner set to westi
  • Severity changed from trivial to normal
  • Status changed from new to accepted
  • Type changed from enhancement to defect (bug)

Replying to duck_:

Surely the translation can just specify the placeholder/argument ordering as part of the translated string itself without the original string having to change?

If there's some reason this cannot be done I would've thought that most strings should specify ordering and that there would be a lot more instances of troublesome strings than just this one.

We should make it as easy as possible for translators to do the translations. Part of this is using numbered placeholders where appropriate so as to make the translation process faster.

comment:5 follow-up: ↓ 6   zeo19 months ago

Almost related to [15522].

Also the patch above is missing translators notes/comments

comment:6 in reply to: ↑ 5   SergeyBiryukov19 months ago

Replying to zeo:

Also the patch above is missing translators notes/comments

Thanks, added comments in 19090.2.patch.

  • Resolution set to fixed
  • Status changed from accepted to closed

In [19255]:

Used numbered format specifiers. Add translator note. Props SergeyBiryukov. fixes #19090

Note: See TracTickets for help on using tickets.