sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (0)
Sophie ([personal profile] sophie) wrote in [site community profile] dw_dev 2012-06-15 11:39 am (UTC)

Re: Yes, this has been encountered before

I've done the same thing. If you look at dw-nonfree/htdocs/index.bml , you'll see that I do this:

        $headextra .= <<HEAD;
<script type="text/javascript">
    var ml = new Object();

HEAD
        $headextra .= "    ml.joinheading = \"" . BML::ml( ".create.join_dreamwidth",  { sitename => $LJ::SITENAMESHORT } ) . "\";\n";
        $headextra .= <<HEAD;
    ml.entercode   = "$ML{'.create.enter_code'}";
    ml.usecode     = "$ML{'.create.use_code'}";
    ml.cancel      = "$ML{'.create.cancel'}";

HEAD
        $headextra .= "    var invitelength = " . DW::InviteCodes::CODE_LEN . ";\n";
        $headextra .= "    var siteroot = \"" . $LJ::SITEROOT . "\";\n";
        $headextra .= "</script>\n";


That causes it to make output that looks like this:

<script type="text/javascript">
    var ml = new Object();

    ml.joinheading = "Join YourSite";
    ml.entercode   = "Enter your invite code:";
    ml.usecode     = "Use Code";
    ml.cancel      = "Cancel";

    var invitelength = 20;
    var siteroot = "http://www.daily.hack.dreamwidth.net";
</script>


I can then use ml.joinheading and such in the JavaScript to refer to the strings.

Post a comment in response:

If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org