Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#19090 closed defect (bug) (fixed)

Write strings in numbered argument conversion specifications form for better understanding

Reported by: jiehanzheng's profile jiehanzheng Owned by: westi's profile westi
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.3
Component: I18N Keywords: has-patch
Focuses: 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 14 years ago.
19090.2.patch (1.1 KB) - added by SergeyBiryukov 13 years ago.

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
14 years ago

  • 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

#2 follow-ups: @duck_
14 years 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.

#3 in reply to: ↑ 2 @jiehanzheng
14 years 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.

#4 in reply to: ↑ 2 @westi
14 years 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.

#5 follow-up: @zeo
13 years ago

Almost related to [15522].

Also the patch above is missing translators notes/comments

#6 in reply to: ↑ 5 @SergeyBiryukov
13 years ago

Replying to zeo:

Also the patch above is missing translators notes/comments

Thanks, added comments in 19090.2.patch.

#7 @ryan
13 years ago

  • 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.