is there any way to speed up the string localization on ASp.Net mvc3 with razor? Lest say I write on my .cshtml "Hello World", and then I want to send that "Hello world" to the resources, with an automatic Id and refactor that string to the calling the resource, with just some clicks. Something like http://resourcerefactoring.codeplex.com/ but for VS 2010 and razor.
And Free!
Thanks!
So I touch some few lines of the Resource Refactoring Tool and I make it work with Razor (cshtml files). You can find the source and the installer here: http://www.ranu.com.ar/2011/07/faster-localization-on-aspnet-mvc3-with.html
I have used a helper for this, which get's a key for what you need to translate like this
@Html.Translate("MyHeader1")
and in the helper I took the value from the resources file I used, but you can also use a DB or what ever you want to getting the translation data.
String translated = (String)helper.ViewContext.HttpContext.GetGlobalResourceObject("Translation", key);
For development I add an # in front of the key, if no translation could be found, this way if I have something like #MyHeader1 in my user interace I know there is something I have to translate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With