Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Patrick McAndrew 48 posts 163 karma points
    Nov 24, 2011 @ 15:55
    Patrick McAndrew
    0

    Javascript and different language sites

    How do you handle strings in javascript for multi-lingual sites? 

    3 ways I can think of:

    • js resource array that has language/key/translation
    • use page_load to generate any language scripts using umbraco dictionary
    • generate js on backend for each language and include the correct language file

    Any other alternatives I'm missing?  What's your preferred method? 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Nov 24, 2011 @ 16:37
    Jeroen Breuer
    0

    You could also generate your javascript in Razor. Than something like this should work:

    <script type="text/javascript">
    var object1 = 'this is object 1';
    var object2 = '@umbraco.library.SomeMethod("name1")';
    </script> 

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft