We do that all the time, and it works properly for us. Can you show a copy of the HTML generated? Also, the text should be quoted.
@model MyModel
@using My.App.ResourcesProject // if needed
<script type="text/javascript">
var str = "@LocalizedStrings.AlertText";
alert(str);
</script>