0

I've got a method that translates string according to selected language on the webpage, I'm using it to wrap all the strings on html, but I've also got some javascript code that's rendering some html such as in example below, what i need to do is to somehow insert this wrapper method from c# to Javascript. Any ideas on how can i achieve this?

html example:

<div>@Lang("String")</div>

Javascript:

 $(".highchart-tooltip-events").html("<div><strong>Events:</strong></div>" + $evtsList.html());  now this Events string should be passed to the translate method.
3
  • 3
    You can't run c# in JavaScript, you can only do an AJAX request to the server to do the translation for you, or rewrite the function in Javascript. Commented May 27, 2016 at 8:52
  • I hoped there was a way around it, but okay. Thank you. Commented May 27, 2016 at 8:52
  • Take a peek here, its pretty much the same question you ask, you can get a wider view of your options here stackoverflow.com/questions/9406648/… Commented May 27, 2016 at 9:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.