Skip to:
Content

Opened 3 years ago

Closed 3 years ago

#2703 closed defect (bug) (wontfix)

[Translations] Cannot translate strings when actual new line breaks are used instead of \n

Reported by: calvin_42 Owned by: sorich87
Milestone: 1.5 Priority: major
Severity: Version:
Component: Core Keywords: 2nd-opinion close
Cc:

Description

From the support thread Strings containing new lines like emails content are not translated .

Rather than using actual line breaks in strings, using \n and keeping everything on one line resolves this issue. These strings are most of the time the content of the notification emails.

For example, in bp-groups-notifications.php:22 :

Replace :

$message = sprintf( __(
 'Group details for the group "%s" were updated:
	
	To view the group: %s
	
	---------------------
	', 'buddypress' ), $group->name, $group_link );

By:

$message = sprintf( __(
'Group details for the group "%s" were updated:\n\nTo view the group: %s\n\n---------------------\n', 'buddypress' ), $group->name, $group_link );

Attachments (2)

2703.diff (13.3 KB) - added by sorich87 3 years ago.
2703.002.diff (35.5 KB) - added by cnorris23 3 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 calvin_423 years ago

  • Milestone changed from 1.3 to 1.2.7

Shouldn't take too long to replace, so maybe for milestone 1.2.7 ?

comment:2 DJPaul3 years ago

  • Milestone changed from 1.2.7 to 1.3

No, don't want to change any strings in 1.2.7 if at all possible, to avoid translators having to update language files for a tiny bug-fix release. 1.3's not far away, however.

sorich873 years ago

comment:3 sorich873 years ago

  • Keywords has-patch added
  • Owner set to sorich87
  • Status changed from new to accepted

comment:4 boonebgorges3 years ago

2703.diff breaks the swappable characters. Because they appear in double-quotes (to make the line breaks work), the $s in %1$s is getting processed as an empty variable. sorich87, could you repatch and escape them so they read %1\$s ?

comment:5 cnorris233 years ago

Added escaping, random code cleanup, and documentation.

cnorris233 years ago

comment:6 DJPaul3 years ago

  • Keywords needs-patch added; has-patch removed

Could this be re-patched per Boone's comments, without any other changes? Whilst the other bits in 2703.002.diff are good, the patch won't apply because of changes in trunk. The more concise patches are, the easier they are to manually apply in such cases.

comment:7 SergeyBiryukov3 years ago

This has to do with different line endings on Windows and Unix.

WordPress has multiple line strings too, which are perfectly valid unless using TortoiseSVN checkout under Windows.

The suggestion in the ticket would make the strings extremely hard to read and translate.

It's actually a gettext bug and should be treated on a more general level, perhaps in WordPress itself.

comment:8 DJPaul3 years ago

  • Keywords 2nd-opinion close added; needs-patch removed

comment:9 cnorris233 years ago

@DJPaul, are you thinking about giving this ticket the ole wontfix? If not, I'll trim down the patch, otherwise, I don't want to waste my time.

comment:10 DJPaul3 years ago

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

I think so. Closing as wontfix per SergeyBiryukov's comments.

Note: See TracTickets for help on using tickets.