[dw-free] English-strip "Tell a Friend"
[commit: http://hg.dwscoalition.org/dw-free/rev/018d9dc92fec]
http://bugs.dwscoalition.org/show_bug.cgi?id=620
English strip tellafriend.
Patch by
syntheid.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=620
English strip tellafriend.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- htdocs/tools/tellafriend.bml
-------------------------------------------------------------------------------- diff -r c93d50b08ef6 -r 018d9dc92fec htdocs/tools/tellafriend.bml --- a/htdocs/tools/tellafriend.bml Wed Apr 15 04:23:12 2009 +0000 +++ b/htdocs/tools/tellafriend.bml Wed Apr 15 04:38:01 2009 +0000 @@ -17,7 +17,7 @@ LJ::set_active_crumb('tellfriend'); - $title = "Tell a Friend!"; + $title = BML::ml( ".title" ); $body = ""; my $remote = LJ::get_remote(); @@ -26,7 +26,7 @@ my $sth; if ($LJ::DISABLED{'tellafriend'}) { - $body .= "This feature is disabled."; + $body .= BML::ml( ".error.disabled" ); return; } @@ -39,19 +39,22 @@ # Email not validated unless ($u->{'status'} eq "A") { - $body .= "<?h1 Sorry... h1?><?p Your current email address (" . $u->email_raw . ") isn't validated, so we can't let you use the \"Tell a Friend\" feature. To validate your email address, <a href=\"$LJ::SITEROOT/register.bml\">have the confirmation email resent</a>, and then follow the instructions in it when you get it. p?>"; + $body .= "<?h1 " . BML::ml( ".invalidemailpage.title" ) . " h1?><?p " . BML::ml( ".invalidemailpage.body", + { emailaddress => $u->email_raw, siteroot => $LJ::SITEROOT } + ) . " p?>"; return; } my $err = sub { - $title = "Error"; - $body = "<?h1 Error h1?><?p $_[0] p?>"; + $title = BML::ml( ".errorpage.title" ); + $body = "<?p " . BML::ml( ".errorpage.body", + { errormessage => $_[0] } + ) . " p?>"; return; }; - my $msg_footer = "\n\nEnjoy!\n- " . $u->{user} . "\n\n--\n$LJ::SITENAME Team\n" . - "Read the latest $LJ::SITENAMESHORT news at http://news.livejournal.com/\n"; - my $custom_msg = "\n\nCustom message from " . $u->{user} . ":"; + my $msg_footer = BML::ml( ".email.body.footer", { user => $u->{user}, sitename => $LJ::SITENAME, sitenameshort => $LJ::SITENAMESHORT, domain =>$LJ::DOMAIN } ); + my $custom_msg = "\n\n" . BML::ml( ".email.body.custom", { user => $u->{user} } ); # Tell a friend form submitted if ($POST{'mode'} eq "mail") @@ -60,25 +63,27 @@ my @errors; my @emails = split /,/, $email; - push @errors, "No email addresses found" unless (scalar @emails); + push @errors, BML::ml( ".error.noemail" ) unless (scalar @emails); foreach my $em ( @emails ) { LJ::check_email($em, \@errors); } # Check for images if ($POST{'body'} =~ /<(img|image)\s+src/i) { - push @errors, "Images are not allowed in this message."; + push @errors, BML::ml( ".error.forbiddenimages" ); } # Check for external URLs foreach ( LJ::get_urls($POST{'body'}) ) { if ($_ !~ m!^https?://([\w-]+\.)?$LJ::DOMAIN(/.+)?$!i) { - push @errors, "Links to sites other than $LJ::SITENAME are not allowed in this message."; + push @errors, BML::ml( ".error.forbiddenurl", { sitename => $LJ::SITENAME } ); } } push @errors, "<?requirepost?>" unless LJ::did_post(); - push @errors, "Maximum number of messages sent for today" unless ($u->rate_log('tellafriend', scalar @emails)); - push @errors, "Email list greater than 150 characters" if (length($POST{'toemail'}) > 150); + push @errors, BML::ml( ".error.maximumemails" ) unless ($u->rate_log('tellafriend', scalar @emails)); + push @errors, BML::ml( ".error.characterlimit" ) if (length($POST{'toemail'}) > 150); if (@errors) { - $title = "Error"; + # This piece left uncommented causes the Error page to have two titles displaying "Error" + # Without the line, it displays "Tell a friend!" first, then "Error" which seems more helpful. + # $title = BML::ml( ".errorpage.title" ); $body = LJ::bad_input(@errors); return; } @@ -93,7 +98,7 @@ LJ::send_mail({ 'to' => $POST{'toemail'}, 'from' => $u->{'emailpref'}, - 'fromname' => $u->user . " via $LJ::SITENAMESHORT", + 'fromname' => $u->user . BML::ml( ".via" ) . " $LJ::SITENAMESHORT", 'charset' => 'utf-8', 'subject' => $POST{'subject'}, 'body' => $msg_body, @@ -102,9 +107,9 @@ my $referer = BML::get_client_header('Referer'); my $tolist = $POST{'toemail'}; $tolist =~ s/(,\s*)/<br \/>/g; - $body .= "<?h1 Sent! h1?>"; - $body .= "<?p <a href='$referer'>Tell another friend.</a> p?>\n"; - $body .= "<?p The following people have been mailed:<br />" + $body .= "<?h1 " . BML::ml( ".sentpage.title" ) . " h1?>"; + $body .= "<?p <a href='$referer'>" . BML::ml( ".sentpage.body.tellanother" ) . "</a> p?>\n"; + $body .= "<?p " . BML::ml( ".sentpage.body.mailedlist" ) . "<br />" . $tolist . " p?>"; return; } @@ -115,18 +120,18 @@ $body .= LJ::html_hidden({ name => 'mode', value => 'mail' }); $body .= "<table cellpadding=3 border=0>"; - $body .= "<tr><td align=right nowrap>From:</td><td>" . + $body .= "<tr><td align=right nowrap>" . BML::ml( ".email.fromfield" ) . "</td><td>" . LJ::ehtml($u->{'name'} || $u->{'user'}) . " <$u->{'emailpref'}></td></tr>\n"; - $body .= "<tr><td align=right valign='top'>Email Recipients:</td>" . + $body .= "<tr><td align=right valign='top'>" . BML::ml( ".email.recipientfield" ) . "</td>" . "<td>" . LJ::html_text({ name => 'toemail', size => 60, maxlength => 150 }) . - "<br /><span class='detail'>comma separated, maximum of 150 characters</span></td></tr>\n"; + "<br /><span class='detail'>" . BML::ml( ".email.formatinfo" ) . "</span></td></tr>\n"; my ($subject, $msg); - $subject = "Check this out..."; + $subject = BML::ml( ".email.subject.noentry" ); if ($GET{'itemid'} =~ /^\d+$/) { my $journal = $GET{'journal'}; @@ -134,12 +139,12 @@ my $ditemid = $itemid; my $uj; - $subject = "Check out this $LJ::SITENAMESHORT entry"; + $subject = BML::ml( ".email.subject.entry", { sitenameshort => $LJ::SITENAMESHORT } ); $itemid = int($itemid / 256); $uj = LJ::load_user($journal); - return $err->("Unknown journal") unless $uj; + return $err->(BML::ml( ".error.unknownjournal" )) unless $uj; my $entry = LJ::Entry->new($uj->{'userid'}, jitemid => $itemid); @@ -150,22 +155,21 @@ my @errors; my $uisjowner = ($pu->{'user'} eq $u->{'user'}); if ( !$uisjowner && $entry->security ne 'public' ) { - $err->("You can only tell your friends about public posts on other people's journals."); + $err->(BML::ml( ".email.warning.public" )); return; } if ( $uisjowner && $entry->security eq 'private' ) { - $err->("You can not tell your friends about posts you marked as private."); + $err->(BML::ml( ".email.warning.private" )); return; } if ( $uisjowner && $entry->security eq 'usemask' ) { - push @warn, "<b>Friends-Only!</b> Only people who are on your friends list can see this entry."; - $msg_footer = "\n\nYou will need to be logged-in and on " . $u->{'user'} . "'s friends list to read this entry. Don't have an account yet? Just <a href='$LJ::SITEROOT/create.bml?from=$u->{user}'>create one</a>, it's free." . $msg_footer; + push @warn, BML::ml( ".email.warning.usemask" ); + $msg_footer = "\n\n" . BML::ml( ".email.usemask.footer", { user => $u->{'user'}, siteroot => $LJ::SITEROOT } ) . "$msg_footer"; } - $msg .= "Hi,\n\n" . $u->{'user'} . - " wants to share this $LJ::SITENAMESHORT entry with you:\n\n"; - $msg .= " Title: $subject\n" if $subject; - $msg .= " URL: $url "; + $msg .= BML::ml( ".email.body", { user => $u->{'user'}, sitenameshort => $LJ::SITENAMESHORT } ); + $msg .= BML::ml( ".email.sharedentry.title" ) . " $subject\n" if $subject; + $msg .= BML::ml( ".email.sharedentry.url" ) . " $url "; } if ($GET{'user'} =~ /^\w{1,15}$/) { @@ -173,12 +177,12 @@ my $uj = LJ::load_user($user); my $url = $uj->journal_base; - $subject = "Check out this journal"; + $subject = BML::ml( ".email.subject.journal" ); if ($user eq $u->{'user'}) { - $msg .= "Hey,\n\nCheck out my journal that I'm keeping online:\n\n"; + $msg .= BML::ml( ".email.body.yourjournal" ); $msg .= " $url "; } else { - $msg .= "Hey,\n\nCheck out my friend's journal online:\n\n"; + $msg .= BML::ml( ".email.body.otherjournal" ); $msg .= " $url "; } } @@ -198,13 +202,13 @@ $display_msg_footer =~ s/\n/<br \/>/gm; $body .= LJ::html_hidden({ name => 'subject', value => "$subject" }); $body .= LJ::html_hidden({ name => 'body_start', value => $msg }); - $body .= "<tr><td valign=top colspan='2'>Your message to them:<br />" . + $body .= "<tr><td valign=top colspan='2'>" . BML::ml( ".email.body.boxtitle" ) . "<br />" . "<div class='message'><blockquote>" . $display_msg . "<br /><textarea name=body rows=6 cols=55 wrap=soft></textarea>" . "$display_msg_footer</blockquote></div></td></tr>\n"; $body .= "<tr><td colspan='2' align='center'><?standout " . - LJ::html_submit("Send") . " standout?></td></tr>\n"; + LJ::html_submit(BML::ml( ".sendbutton" )) . " standout?></td></tr>\n"; $body .= "</table>"; $body .= "</form>"; --------------------------------------------------------------------------------