title: Best way to use C#-Ressources (ResX Files) in Typescript?
body: <p>our current project is in ASP.Net MVC with Razor.
  We use ResX Files for a few thousend translations.
  In C# and Asp.net Razor this is pretty easy with HTML:</p>
  
  <pre><code>&lt;div&gt;@Ressources.Local.Test&lt;/div&gt;
  </code></pre>
  
  <p>Now when I wrote JavaScript I normaly did this within the cshtml files with razor like this:</p>
  
  <pre><code>&lt;script&gt;alert('@Ressources.Local.Test');&lt;/script&gt;
  </code></pre>
  
  <p>Which works but seems a bit ugly... </p>
  
  <p>A few weeks ago we starded with Typescript, and, of course excluding (nearly) all javascript code to ts-files.</p>
  
  <p>The only solution we found here, to get the ressources from C# to Typescript is through a "hack":</p>
  
  <p>We made a ressources.cshtml file in which we just include javascript variables:</p>
  
  <pre><code>var ressourceTest = "@Ressource.Local.Test";
  </code></pre>
  
  <p>We load this ressource.cshtml at first in our _layout.cshtml.
  Additional, we have a self need a selfmade declarion for this variable to jump from javascript to typescript in our projectDeclarions.d.ts:</p>
  
  <pre><code>var ressourceTest:string;
  </code></pre>
  
  <p>And now we can use the ressource in our typescript file test.ts:</p>
  
  <pre><code>alert(ressourceTest);
  </code></pre>
  
  <p>As you can see it is a working "hack" or "workaround" but it seems to likly kill us for a few thousend ressources... It's handmade, the maintain duration and work is high... </p>
  
  <p>Any better ideas?</p>