There is already 7th beta version of ASP.NET 5, in which they say localization features are done. How can I use localization to write multi-language applications in asp.net 5 mvc 6 with visual studio 2015? Is there any working example project for beta 7 version? I have already searched and found many examples but they no more work because the code has been changed since that. Can I still use .resx files (because visual studio does not auto-generate Designer.cs files any more) or are there any newer or alternative methods they suggest?
Beta 7 introduced the localization, so it's really brand new. I wrote a short write up of everything that is new on my blog. There are a lot of things new, so if you need the features, I recommend reading it.
You can in fact still use Resx, but you have to understand that the resolution by default is, that the engine tries to find the resx file that matches the view.
For example, if you have a HomeController, and an action called Locpage, you need to have Views.Home.Locpage.cshtml.en-GB.resx to Support en-GB locale. The best part, however, is that you don't really need a resx file anymore :-). You can just implement your own implementation of IStringLocalizer and IStringLocalizerFactory, and it'll work. You can see the code for this on my blog, above.
If you want a working sample, the best place right now is their GitHub, so this right here: https://github.com/aspnet/Mvc/tree/dev/samples/LocalizationSample.Web.
Related
I've just started playing around with JetBrains Rider IDE using one of my existing ASP.NET MVC projects. When attempting to create a new Razor View from template, I've been unable to find any templates which refer to Razor as stated here. These are all the templates I can see when adding a file template to a chosen folder.
Am I missing something like a plugin, nuget etc...? If worst comes to worst, then I don't mind creating them, it's just a slight annoyance that it clearly states they should be there.
OS: Windows 10 Build 17134
JetBrains Rider: 2018.1 Build #RD-181.4379.1191, built on April 14,
2018
Update
I've raised this with JetBrains support and so far they've advised that some predefined templates (Razor being one) are only available in subfolders of Views folder. More info can be found here. Sadly it's still not working for me but thought I'd add as it may help someone.
It's a bug! It's seems to be okay when creating a new solution but then at corrupts the template analytics when updating nugets and/or adding OWIN (I'm guessing the Startup.cs in the root of the project has something to do with it as well).
YouTrack: https://youtrack.jetbrains.com/issue/RSRP-469774
Update
It took nearly 5 years but they finally fixed it. I don't even use that IDE anymore lol!
I have a project I was brought onto a few years ago and the original developer is no longer available. We have an Umbraco 6 based website. The solution has two projects, a Web Site and a class library call Umbraco.Extensions. I believe I read some conventional wisdom pertaining to Umbraco at some point where it is recommended to split it up like this but I am looking for more information about this particular style of setup and how it is supposed to work. For example right now I am dealing with a missing assembly issue, and i fixed it by copying a dll from the bin of Extensions to the bin of the Web Site. How is this handled regularly?
it's generally a good idea to keep the projects separated. You should have some kind of automation (maybe a post-build action) to copy the dll of the class library to the bin of the umbraco project. Or maybe rebuild the umbraco project with the correct references, but I dont usually do that.
I have worked with previous versions of Umbraco in the past but am currently evaluating Umbraco 7 for a new project. I am looking for a more conventional approach than the default "txt" starter project that is suggested by default. Are there any other starter kits that are compatible with Umbraco 7? Preferably one that has good examples of the new MVC Razor code and page hierarchy.
Yep, the local gov, or here, or even here.
Have fun.
I have refereed old questions and found that people face many issues after installing mvc3 and MVC4 on same machine.
My question is how is your recent experience for the same and how the mixture works for you guys.
I want to create one solution which will have four projects out of them two are MVC projects. One is MVC3 and another is MVC4.
Let me know your views on this.
Thanks,
Jigar
In short - there shouldn't be a problem. Once 3 & 4 are both installed, the two use different project templates and the references to the MVC assemblies are specifically targetted at the correct versions.
Beyond that, the web.configs of the two sites then determine the other assemblies that are used - and since they are seeded by the project templates they will be correct.
Now, if you were asking about having 3 & 4 in the same project, that would be another story. But then you wouldn't do that.
It's true there are a few known issues with the Razor editor and stuff like that - but none of those are show-stoppers and are almost certainly likely to have been fixed by the time v4 RTMs.
I am building a project system for Visual Studio MVC web projects with controllers written in F#. It comes along pretty cool. I can build and run the apps, but I have a problem with FSharp Language Service.
In the editor it shows the syntax colorization and diagnostic as it should. With one problem - it does not pick up project references. Even though during build it picks them up and successfully builds the project, on the screen it shows the objects/namespaces from the referenced assemblies/projects as unresolved.
If somebody out here has some knowledge about integrating with F# Language service - please help me make it work
In response to Tomas:
The code for F# controllers is in the project file and as I already mentioned I can compile and run it. Originally we kept the F# code in a separate project and desire to get rid of this extra complexity is what prompted this project. It is not a ASP.MVC though it is Bistro MVC.
Edit
BistroMVC now solves this problem in the latest version of the Bistro Designer which is based on the F# project extender
Do you keep your F# source code as part of the Web Project? I'm not sure if this is even possible for ASP.NET MVC, but it was possible in ASP.NET WebForms. With WebForms projects, it didn't work very well (because F# wasn't aware of the project context). I believe it was possible to overcome this with a hacky #if like this:
#if EDITING
#r "Your.Referenced.Library.dll"
#endif
This would serve only as a hint to the editor... However it is much better idea (if it is possible) to write F# controllers in a separate F# project. In that case you shouldn't have any issues (at least I hope so!)
Can you describe what you're doing in more detail? Is this a "flavoring", or a new project system? Are other aspects of the 'project environment' picked up? For example, if you have F# code with
#if DEBUG
let x = 3
#else
let x = 4
#endif
does the coloring change when you change the VS solution from Debug to Release?
(Offhand I am unsure if it will be possible to fully integrate the F# language service into a user-defined project system; if you want more of a discussion, you can email fsbugs#microsoft.com and I'll respond there.)