converting existing website to multilingual website of asp.net mvc - asp.net-mvc

I want to convert my existing website which is created in asp.net mvc to a multilingual without resource file.I have a lot of client side content (obtained through ajax in javascript) what is the best possible way?

I wouldn't stray too far from resource files. They're meant to be used for localization, and they're good at it. You may need to template some JSON strings from a resource file, but that'll be faster than a DB lookup, or file read.
For the purpose of localizing client-side content to be displayed to the user, are partial views possible? You'll get the benefit of the typical MVC pipeline (i.e. passing through the localization modules) but also get the content via an Ajax query.

Related

Special kind of Server Side Include of Asp.net MVC

i have to create a new asp.net mvc page that integrates content provided by a cms on the server side static. my mvc page provides a masterpage with the navigation and certain links should point to pages of the cms (which is installed on the same server). it should be something like a "server side iframe".
my idea is to create a controller which loads the page of the cms using a webrequest, extracts the body part of the page and passes the extracted data to the view. the view simply outputs the passed html. i also plan to add some logic to pass post requests to the cms (for news letter subscriptions, contact forms, ...)
now my question is: is it possible to implement this solution? or is there a better way to do this on the server side?
Could you use Application Request Routing to just hand off requests to your CMS, or do you need to include the externally provided content within an existing masterpage?
If you need to use the masterpage I would stick to the solution you suggest, although I might investigate the most robust and efficient option for querying the content from the CMS and perhaps if caching would be a good option.
It is undoubtedly possible, but keeping track of users, authentication, cookies etc. seems like a really tedious job. Also, embedding css classes, hard-coded styling etc. from the CMS in your MVC site could give you a severe headache.
If the CMS isn't home-brewed it probably has an API. In that case I would much prefer to use the API to get at the data I needed and then render that data using pure MVC. This will give you a much cleaner and more stable integration with the CMS.

multilingual web site using database

I made a multilingual site using resource files (ASP.NET MVC 2). Now I want to use the database in order to make a page where the user can input the information that will be published on the site. Does this mean that I can no longer use resource files? On the way to keep multilingualism using database?
I'm not 100% sure if I get your question, but from a technical and practical point of view you can mix content coming from Resource files and content coming from a database.
For all you static texts (messages, buttons etc) you will use your resources, and for dynamic texts (texts that [often] change) you will use your database.
It is also possible to create your own resource provider, that instead of taking the resources out of a file, it will take it out of a database.
You should try a custom resource provider. You can then choose what resources come from which sources.
The following urls might be of use:
Extending the ASP.NET 2.0
Resource-Provider Model
Creating
a Data Driven ASP.NET Localization
Resource Provider and Editor
For static content you can use resource files but if you need to modify data and you want to translate data in different languages you should use data base. using data base is more flexible.

Use ASP.NET MVC for html brochure websites?

I have a project that will basically be a large brochure html website. Although some content could possibly be database driven in the future. I use ASP.NET MVC for any database driven websites usually, but not sure whether to use it for brochure html websites.
You'd probably want to use Master Pages even if the content is static. Might as well use MVC to keep headers and footers consistent across the site. (Same goes for any language, really.)
You host only plain old html files in it for now. If the need arises for database-driven content, ASP.NET MVC's routing options make it easy to switch to a dynamic site without breaking the links.
We used the same approach for setting up a dummy website for SEO purposes until the real app was developed and the switch to dynamic content was effortless.
The good thing about ASP.NET MVC (as apposed to Webforms? I assume you're asking) is that you can just use basic html and have a designer design up brochure required. If this needs to be more "dynamic" at some stage with forms or CMS etc, using the existing plain html will be easier.
Also if you're using MVC already its a no-brainer...
Danny,
it's possibly also a choice over whether your project sponsor is wanting to pay for windows hosting or whether they go down the linux route. if you know for sure that the site would NEVER be required to take data from a database then you could actually create an app in mvc (your developer app) and then have that app generate the 'flat file' site out to html files. that way, you could store the elements that make up the content in your developer database and regenerate the entire site when required. This approach would reap dividends - for example you decided to add some jquery across the site, then this would do it all in a single hit.
this way of generating flat sites would mean that you could in theory have an engine that you used for multiple clients, changing only the css and content as required.
just my tuppence worth...
jim

form tag - is it required on ajax sites?

i recently was working on an ASP.NET MVC site that basically serves static html and uses ajax gets to return data to the page when inputs are changed. there is actually no posting or getting from an html input tag on the pages at all. (it is a specific style of site that is not used by the general public, so having compatibility problems for people without javascript is not an issue)
after designing the site, i realised that i hadn't even included any form tags. as the site does not use any direct posts or gets, and apart from it being just good html design, i wondered, in my particular situation, if there was any point to having any form tags on the page?
As ASP.NET MVC tries to differ from Web Forms, to introduce a new approach in designing web applications. They do not require forms. In fact i think it's better not to be used for navigation, submitting data, etc. Otherwise, there is no use of the MVC pattern if you still do it "the good old ASP.NET" way.
Of course ... I'm sure there are good reason forms to be used in proper places, but not as a general concept in your design.
You can read here: http://msdn.microsoft.com/en-us/magazine/cc337884.aspx how MVC was introduced in the beginning. "ASP.NET MVC - Building Web Apps without Web Forms" by Chris Tavares
Retaining a form is useful if you need your application to degrade gracefully if JavaScript is disabled or the likes. Also, jQuery and Prototype have nice Ajax helpers for serializing inputs using a form, which is really nice when you have multiple sets of data that could be submitted to different ajax endpoints from one page.
So I guess the answer to my question is no.

ASP.NET MVC+ multilingual page

I'm developing a website using ASP.NET MVC. The website should handle multiple languages.
I would like to ask what are the best practices of handling multiple languagues - both for "static" texts and taken from DB. I read some threads about this on stackoverflow but i'm not sure how can I implement in when data from DB are received. I also read this article
Well, if you need to localize your web application then you can't really use any "static" text. The article link you included talks about using resource files. While this does work in ASP.Net MVC it means that everything in your view pages will have to be an ASP.Net Literal control and you have to push ALL of your textual content into the .RES file and not put any of it in your view pages.
If you have a lot of users from different cultures then using the .RES files will be the way to go. If you have the majority of your users all in one language and just a small percentage in a different language then you may be able to take advantage of Microsoft’s translation engine. You just embed some JavaScript in your page and Microsoft will translate the page’s text for you.

Resources