madeon (madeon) wrote in changelog,
madeon
madeon
changelog

[livejournal] r22179: LJSUP-12262: Push notifications localiza...

Committer: sbelyaev
LJSUP-12262: Push notifications localization improvements
U   trunk/cgi-bin/LJ/Event/Befriended.pm
U   trunk/cgi-bin/LJ/Event/Birthday.pm
U   trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm
U   trunk/cgi-bin/LJ/Event/Defriended.pm
U   trunk/cgi-bin/LJ/Event/InvitedFriendJoins.pm
U   trunk/cgi-bin/LJ/Event/JournalNewComment.pm
U   trunk/cgi-bin/LJ/Event/JournalNewEntry.pm
U   trunk/cgi-bin/LJ/Event/NewUserpic.pm
U   trunk/cgi-bin/LJ/Event/OfficialPost.pm
U   trunk/cgi-bin/LJ/Event/PollVote.pm
U   trunk/cgi-bin/LJ/Event/UserExpunged.pm
U   trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm
Modified: trunk/cgi-bin/LJ/Event/Befriended.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/Befriended.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/Befriended.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -186,15 +186,17 @@
 
 sub as_push {
     my $self = shift;
-    my $u = shift;
+    my $u    = shift;
+    my $lang = shift;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.befriended", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.befriended", 1, {
         user => $self->friend->user,
     })
 }
 
 sub as_push_payload {
     my $self = shift;
+
     return { 't' => 7,
              'j' => $self->friend->user,   
            };

Modified: trunk/cgi-bin/LJ/Event/Birthday.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/Birthday.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/Birthday.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -209,9 +209,10 @@
 
 sub as_push {
     my $self = shift;
-    my $u = shift;
+    my $u    = shift;
+    my $lang = shift;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.birthday", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.birthday", 1, {
         user    => $self->bdayuser->user(),
         date    => $self->email_bday($u->prop('browselang'))
     })
@@ -219,6 +220,7 @@
 
 sub as_push_payload {
     my $self = shift;
+
     return { 't' => 17,
              'j' => $self->bdayuser->user(),
              'b' => $self->next_bday(),

Modified: trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/CommunityJoinRequest.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -167,9 +167,10 @@
 
 sub as_push {
     my $self = shift;
-    my $u = shift;
+    my $u    = shift;
+    my $lang = shift;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.communityjoinrequest", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.communityjoinrequest", 1, {
         user        => $self->requestor->user(),
         community   => $self->comm->user(),
     })
@@ -177,6 +178,8 @@
 
 sub as_push_payload {
     my $self = shift;
+    my $lang = shift;
+
     return { 't' => 15,
              'j' => $self->comm->user(),
              'u' => $self->requestor->user(),

Modified: trunk/cgi-bin/LJ/Event/Defriended.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/Defriended.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/Defriended.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -168,9 +168,10 @@
 
 sub as_push {
     my $self = shift;
-    my $u = shift;
+    my $u    = shift;
+    my $lang = shift;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.defriended", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.defriended", 1, {
         user => $self->friend->user,
     })
 }

Modified: trunk/cgi-bin/LJ/Event/InvitedFriendJoins.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/InvitedFriendJoins.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/InvitedFriendJoins.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -156,14 +156,17 @@
 sub as_push {
     my $self = shift;
     my $u = shift;
+    my $lang = shift;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.invitedfriendjoins", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.invitedfriendjoins", 1, {
         journal => $self->friend->user,
     })
 }
 
 sub as_push_payload {
     my $self = shift;
+    my $lang = shift;
+
     return '"t":13,"j":"'.$self->friend->user.'"';
 }
 

Modified: trunk/cgi-bin/LJ/Event/JournalNewComment.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -880,6 +880,7 @@
 sub as_push {
     my $self = shift;
     my $u    = shift;
+    my $lang = shift;
     my %opts = @_;
 
     my $parent = $self->comment->parent;
@@ -892,7 +893,7 @@
             if $opts{cut} && length($subject) > $opts{cut};
 
     } else {
-        $subject = LJ::Lang::get_text($u->prop('browselang'), "widget.officialjournals.nosubject")
+        $subject = LJ::Lang::get_text($lang, "widget.officialjournals.nosubject")
     }
 
     # tracking event
@@ -901,7 +902,7 @@
         if($self->event_journal->journaltype eq 'C') {
 
             if($self->comment->parent) {
-                return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.eventtrackcommetstreadinentrytitle", 1, {
+                return LJ::Lang::get_text($lang, "esn.push.notification.eventtrackcommetstreadinentrytitle", 1, {
                     user    => $self->comment->poster->user,
                     subject => $subject, 
                     poster  => $self->comment->parent->poster->user,
@@ -909,14 +910,14 @@
                 });
 
             } else {
-                return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.eventtrackcommetsonentrytitle", 1, {
+                return LJ::Lang::get_text($lang, "esn.push.notification.eventtrackcommetsonentrytitle", 1, {
                     user    => $self->comment->poster->user,
                     subject => $subject,
                     journal => $self->event_journal->user,
                 });
             }
         } else {
-                return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.eventtrackcommetsonentrytitle", 1, {
+                return LJ::Lang::get_text($lang, "esn.push.notification.eventtrackcommetsonentrytitle", 1, {
                 user    => $self->comment->poster->user,
                 subject => $subject,
                 journal => $self->event_journal->user,
@@ -926,19 +927,19 @@
     } else {
 
         if($parent && LJ::u_equals($parent->poster, $u)) {
-            return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.commentreply", 1, {
+            return LJ::Lang::get_text($lang, "esn.push.notification.commentreply", 1, {
                 user    => $self->comment->poster->user,
                 journal => $self->event_journal->user,
             });
 
         } elsif($self->event_journal->journaltype eq 'C') {
-            return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.communityentryreply", 1, {
+            return LJ::Lang::get_text($lang, "esn.push.notification.communityentryreply", 1, {
                 user        => $self->comment->poster->user,
                 community   => $self->event_journal->user,
             })
 
         } else {
-            return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.journalnewcomment", 1, {
+            return LJ::Lang::get_text($lang, "esn.push.notification.journalnewcomment", 1, {
                 user => $self->comment->poster->user,
             })
         }
@@ -947,7 +948,8 @@
     
 sub as_push_payload {
     my $self = shift;
-    my $u = shift;
+    my $u    = shift;  
+    my $lang = shift;
 
     my $entry = $self->comment->entry;
     my $parent = $self->comment->parent;

Modified: trunk/cgi-bin/LJ/Event/JournalNewEntry.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/JournalNewEntry.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/JournalNewEntry.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -429,16 +429,17 @@
 sub zero_journalid_subs_means { undef }
 
 sub as_push {
-    my ($self,$u) = @_;
+    my ($self, $u, $lang) = @_;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.eventtrackjournalpostsentry", { user => $u->user }) . 
+    return LJ::Lang::get_text($lang, "esn.push.notification.eventtrackjournalpostsentry", { user => $u->user }) . 
     ($self->entry->tags 
-       ? LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.eventtrackjournalpostsentry.tagged", { tag => join(', ', $self->entry->tags )})
+       ? LJ::Lang::get_text($lang, "esn.push.notification.eventtrackjournalpostsentry.tagged", { tag => join(', ', $self->entry->tags )})
        : '' );
 }
 
 sub as_push_payload {
     my ($self,$u) = @_;
+
     return { 't' => 19,
              'j' => $u->user,
              'p' => $self->entry->ditemid,

Modified: trunk/cgi-bin/LJ/Event/NewUserpic.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/NewUserpic.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/NewUserpic.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -160,14 +160,17 @@
 sub as_push {
     my $self = shift;
     my $u = shift;
+    my $lang = shift;
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.newuserpic", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.newuserpic", 1, {
         user        => $self->event_journal->user(),
     })
 }
 
 sub as_push_payload {
     my $self = shift;
+    my $self = shift;
+
     return { 't' => 16,
              'j' => $self->event_journal->user(),
            };

Modified: trunk/cgi-bin/LJ/Event/OfficialPost.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/OfficialPost.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/OfficialPost.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -184,8 +184,10 @@
 
 sub as_push {
     my $self = shift;
-    my $u = shift;
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.offcialpost", 1, {
+    my $u    = shift;
+    my $lang = shift;
+
+    return LJ::Lang::get_text($lang, "esn.push.notification.offcialpost", 1, {
         community => $self->event_journal->user,
     })
 }

Modified: trunk/cgi-bin/LJ/Event/PollVote.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/PollVote.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/PollVote.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -190,8 +190,10 @@
 
 sub as_push {
     my $self = shift;
-    my $u = shift;
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.pollvote", 1, {
+    my $u    = shift;
+    my $lang = shift;
+
+    return LJ::Lang::get_text($lang, "esn.push.notification.pollvote", 1, {
         user    => $self->voter->user,
         journal => $u->user,
     })

Modified: trunk/cgi-bin/LJ/Event/UserExpunged.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/UserExpunged.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/UserExpunged.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -105,14 +105,16 @@
 sub is_tracking { 1 }
 
 sub as_push {
-    my ($self, $u) = @_;
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.eventtrackusernamepurged", 1, {
+    my ($self, $u, $lang) = @_;
+
+    return LJ::Lang::get_text($lang, "esn.push.notification.eventtrackusernamepurged", 1, {
         user => $self->event_journal->user
     })
 }
 
 sub as_push_payload {
     my $self = shift;
+
     return { 't' => 24,
              'j' => $self->event_journal->user,
            };

Modified: trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm	2012-06-06 10:49:32 UTC (rev 22178)
+++ trunk/cgi-bin/LJ/Event/UserMessageRecvd.pm	2012-06-06 10:51:38 UTC (rev 22179)
@@ -201,6 +201,7 @@
 sub as_push {
     my $self = shift;
     my $u = shift;
+    my $lang = shift;
     my %opts = @_;
    
     if (exists $opts{'message'}) {
@@ -208,13 +209,14 @@
         return $msg->body; 
     }
 
-    return LJ::Lang::get_text($u->prop('browselang'), "esn.push.notification.usermessagerecvd", 1, {
+    return LJ::Lang::get_text($lang, "esn.push.notification.usermessagerecvd", 1, {
         user => $self->load_message->other_u->{user},
     })
 }
 
 sub as_push_payload {
-    my $self = shift; 
+    my $self = shift;
+    my $lang = shift; 
     my $os = shift;
 
     return { 'm' => int($self->arg1),

Tags: livejournal, madeon, pm, sbelyaev
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments