Committer: iaskarov
LJSV-1235 Base new style default language on account settingsU trunk/cgi-bin/LJ/Customize.pm U trunk/cgi-bin/LJ/S2.pm
Modified: trunk/cgi-bin/LJ/Customize.pm =================================================================== --- trunk/cgi-bin/LJ/Customize.pm 2011-03-11 03:08:09 UTC (rev 18506) +++ trunk/cgi-bin/LJ/Customize.pm 2011-03-11 04:37:17 UTC (rev 18507) @@ -222,6 +222,9 @@ } $style{'i18nc'} = $i18nc; $style{'i18n'} = $i18n; + + return \%style if($opts{return}); + $class->implicit_style_create($u, %style); } Modified: trunk/cgi-bin/LJ/S2.pm =================================================================== --- trunk/cgi-bin/LJ/S2.pm 2011-03-11 03:08:09 UTC (rev 18506) +++ trunk/cgi-bin/LJ/S2.pm 2011-03-11 04:37:17 UTC (rev 18507) @@ -676,6 +676,8 @@ my $opts = shift || {}; my $u = $opts->{u} || LJ::get_active_journal(); + my $remote = LJ::get_remote(); + my $style_u = $opts->{style_u} || $u; # but it doesn't matter if we're using the minimal style ... @@ -707,6 +709,17 @@ %style = $u ? get_style($styleid, { 'u' => $style_u }) : get_style($styleid); } + if($remote) { + my $bl = $remote->prop('browselang'); + + if($bl) { + my $style = LJ::Customize->save_language($u, $bl, 'return' => 1); + + $style{i18nc} = $style->{i18nc} if ($style->{i18nc}); + $style{i18n} = $style->{i18n} if ($style->{i18n}); + } + } + my @layers; foreach (qw(core i18nc layout i18n theme user)) { push @layers, $style{$_} if $style{$_}; @@ -764,6 +777,7 @@ $ctx->[S2::SCRATCH] ||= {}; LJ::S2::populate_system_props($ctx); + S2::set_output(sub {}); # printing suppressed S2::set_output_safe(sub {}); eval { S2::run_code($ctx, "prop_init()"); };