ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[livejournal] r16313: LJSUP-5521: Server error text localisati...

Committer: ssafronova
LJSUP-5521: Server error text localisation - langpref cookie add, /interface/ handling fixed
U   trunk/cgi-bin/Apache/LiveJournal.pm
Modified: trunk/cgi-bin/Apache/LiveJournal.pm
===================================================================
--- trunk/cgi-bin/Apache/LiveJournal.pm	2010-03-03 10:16:41 UTC (rev 16312)
+++ trunk/cgi-bin/Apache/LiveJournal.pm	2010-03-03 10:39:16 UTC (rev 16313)
@@ -904,7 +904,7 @@
         if ($int =~ /^flat|xmlrpc|blogger|elsewhere_info|atom(?:api)?$/) {
             $RQ{'interface'} = $int;
             $RQ{'is_ssl'} = $is_ssl;
-            LJ::Request->push_handlers(PerlHandler => \&interface_content);
+            LJ::Request->set_handlers(PerlHandler => \&interface_content);
             return LJ::Request::OK
         }
         if ($int eq "s2") {
@@ -1646,6 +1646,14 @@
 {
     my $args = LJ::Request->args;
 
+    # simplified code from 'package BML::Cookie' in Apache/BML.pm
+    my $cookie_str = LJ::Request->header_in("Cookie");
+    if ($cookie_str =~ /\blangpref=(\w{2,10})\/\d+\b/) { # simplified code from BML::decide_language
+        my $lang = $1;
+        # Attention! LJ::Lang::ml uses BML::ml in web context, so we must do full BML language initialization
+        BML::set_language($lang, \&LJ::Lang::get_text);
+    }
+
     if ($RQ{'interface'} eq "xmlrpc") {
         return LJ::Request::NOT_FOUND unless LJ::ModuleCheck->have('XMLRPC::Transport::HTTP');
         my $server = XMLRPC::Transport::HTTP::Apache
@@ -1860,6 +1868,9 @@
 
 use vars qw($AUTOLOAD);
 
+# pretend we can do everything; AUTOLOAD will handle that
+sub can { 1 }
+
 sub AUTOLOAD {
     my $method = $AUTOLOAD;
     $method =~ s/^.*:://;

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