locked
External Javascript files localization RRS feed

  • Question

  • User206383436 posted

    I am localizing messages in Javascript code and I took the following approach posted by someone some time ago:

    <script type = "text/javascript">
            function ShowGreetings() {
                var message = '<%=GetGlobalResourceObject("Resource", "Greetings") %>';
                alert(message);
            }
    </script>

    This works fine if JavaScript code is inside the .aspx page but, what if such code is within a ".js" file and such a file is included in the .aspx page using <script src="../Scripts/File.js" type="text/javascript"></script> ???

    I have tried this approach in external ".js" files and it did not work when testing my web site in my development PC.

    I will very much appreciate any advice.

    Respectfully,
    Jorge Maldonado 

    Friday, January 27, 2012 10:43 AM

Answers