Skip to:
Content

BuddyPress.org

Opened 14 years ago

Closed 14 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's profile calvin_42 Owned by: sorich87's profile 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 14 years ago.
2703.002.diff (35.5 KB) - added by cnorris23 14 years ago.

Download all attachments as: .zip

Change History (12)

#1 @calvin_42
14 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 ?

#2 @DJPaul
14 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.

@sorich87
14 years ago

#3 @sorich87
14 years ago

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

#4 @boonebgorges
14 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 ?

#5 @cnorris23
14 years ago

Added escaping, random code cleanup, and documentation.

@cnorris23
14 years ago

#6 @DJPaul
14 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.

#7 @SergeyBiryukov
14 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.

#8 @DJPaul
14 years ago

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

#9 @cnorris23
14 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.

#10 @DJPaul
14 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.