Alexander Nazarov (nfokz) wrote in changelog,
Alexander Nazarov
nfokz
changelog

[livejournal] r21831: LJSUP-11969: Add an api to insert transl...

Committer: anazarov
LJSUP-11969: Add an api to insert translated template into page
U   trunk/cgi-bin/weblib.pl
Modified: trunk/cgi-bin/weblib.pl
===================================================================
--- trunk/cgi-bin/weblib.pl	2012-04-27 12:33:14 UTC (rev 21830)
+++ trunk/cgi-bin/weblib.pl	2012-04-27 12:40:49 UTC (rev 21831)
@@ -1406,6 +1406,7 @@
                 filter             => $LJ::TEMPLATE_FILTER,
             );
 
+            # Create template id
             my $key = $template;
             $key =~ s{(?<!\\)/} {-}g;
             $key =~ s{\.tmpl$} {}g;
@@ -1417,13 +1418,16 @@
                     %s
                     </script>
                 }, $key, $path, $file, $LJ::TEMPLATE_FILTER, $LJ::TEMPLATE_TRANSLATION, $data->raw_output();
-
-
             } else {
                 $ret .= sprintf q{
                     <script type="text/plain" id="%s">%s</script>
                 }, $key, $data->raw_output();
             }
+
+            # Let js know about template 
+            $ret .= sprintf q{
+                <script>LJ.UI.registerTemplate('%s', '%s', '%s');</script>
+            }, $key, $key, $LJ::TEMPLATE_TRANSLATION;
         }
 
         return $ret;

Tags: anazarov, livejournal, nfokz, pl
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