slartyblartfast (slartyblartfast) wrote in changelog,
slartyblartfast
slartyblartfast
changelog

[livejournal] r16157: LJSUP-5451: Publication Writer's block t...

Committer: mchernyshev
LJSUP-5451: Publication Writer's block to RU- and US-Journals
- Writers block widget.
U   trunk/cgi-bin/LJ/Widget/QotD.pm
Modified: trunk/cgi-bin/LJ/Widget/QotD.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/QotD.pm	2010-01-28 08:38:57 UTC (rev 16156)
+++ trunk/cgi-bin/LJ/Widget/QotD.pm	2010-01-28 08:46:46 UTC (rev 16157)
@@ -60,6 +60,22 @@
     return $ret;
 }
 
+my %cyr_countries = map { lc $_, $_ => $_ } qw(AM AZ BY EE GE KG KZ LT LV MD RU TJ TM UA UZ);
+
+sub community_name {
+    my $class = shift;
+    my $u = shift;
+
+    $u = LJ::get_remote() unless $u;
+
+    my $country;
+    $country = lc $u->country if $u;
+    $country = lc LJ::country_of_remote_ip() unless $country;
+
+    return 'writersblock' .
+        (exists($cyr_countries{$country}) ? '_ru' : '');
+}
+
 ##
 ## Returns hash with question data
 ## 
@@ -121,6 +137,7 @@
 
     my $questions = $opts{questions} || [];
     my $remote = LJ::get_remote();
+    my $community_name = $class->community_name($remote);
 
     my $ret;
     if (@$questions) {
@@ -150,11 +167,11 @@
 
             my $add_friend = '';
             my $writersblock = LJ::load_user("writersblock");
-            $add_friend = "<li><span><a href='$LJ::SITEROOT/friends/add.bml?user=writersblock'>" . $class->ml('widget.qotd.add_friend') . "</a></span></li>"
+            $add_friend = "<li><span><a href='$LJ::SITEROOT/friends/add.bml?user=$community_name'>" . $class->ml('widget.qotd.add_friend') . "</a></span></li>"
                 if $writersblock && !LJ::is_friend($remote,$writersblock);
 
             my $add_notification = '';
-            $add_notification = "<li><span><a href='$LJ::SITEROOT/manage/subscriptions/user.bml?journal=writersblock&event=JournalNewEntry'>" . $class->ml('widget.qotd.add_notifications') . "</a></span></li>"
+            $add_notification = "<li><span><a href='$LJ::SITEROOT/manage/subscriptions/user.bml?journal=$community_name&event=JournalNewEntry'>" . $class->ml('widget.qotd.add_notifications') . "</a></span></li>"
                 unless $writersblock && $remote && $remote->has_subscription(
                     journal         => $writersblock,
                     event           => 'JournalNewEntry',

Tags: livejournal, pm, slartyblartfast
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