ASP.NET MVC - Multiple Internationalization on the same page - asp.net

Some co-workers and I are develping an application in which we need to have multiple languages. Our idea is to have the header's language following the user's browser settings while the content's language of the webpage will be changed when the user click somewhere.
We've tried using the usual resources technique, but it applies the translation to the whole website - and that's not the goal.
Is it possible to add multiple-language translation to the same page?
In other terms, we'd like the layout to load Resources_EN.resx while the page's content to load Resources_ES.resx.

Related

What Web content can and should be served dynamically vs staticly?

Until recently I've been using WordPress for my nonprofit's website, but have noticed most my site's content is fairly static (I think), and would probably benefit from being served as a static page instead of having to retrieve data from a Sql database.
(Yah I use a caching plugin, but those things are notoriously complicated to set up and manage things like expiration and recaching).
Which got me thinking... Theoretically, what parts of my site actually need to be 'dynamic' to run? And more importantly would there actually be a speed benefit from converting the pages that don't have to be dynamic from wordpress to regular html?
(Note: I'm ignoring the time it would take to convert dynamic files into static ones, just focusing on the visitor's experience).
Eg.
-Things like a home or about page, with their headers and footers and jquery and CSS design - could in theory be static.
-Blog posts could also be static and even a list of new posts and snippets could be generated off the server and converted to a static page.
-User facing options - creating events, a donation form, purchasing items with limited inventory - do these all have to be dynamic? If they're embedded into the page then does the whole page slow down from the dynamic request, or can just that section (eg a login modal) be run dynamically.
Yes, it sounds like you could serve up those pages statically. The reason I like using a content management system like Wordpress is that it separates the design from the content and it's easy to make edits. Separating the design from the content means that you can easily make design changes to your whole site by tweaking the CSS of your theme or changing the theme entirely.And even if you only edit the 'About' page once in a blue moon, it's nice to be able to do it quickly and easily. Database calls to get content shouldn't slow things down in a way that would be noticeable compared to a static page.
If you really want to make some pages static, you could try a plugin like this for Wordpress that can wrap your Wordpress theme around a static page:
https://wordpress.org/plugins/static-pages/
But I think you are overthinking the Static/Dynamic thing a little bit.
Hope this helps,
Kristen

Import asp.net and html pages in Umbraco CMS

I am new to Umbraco CMS. I have an existing website which is developed in asp and asp.net.
Now I have requirement to convert this existing website to new website using Umbraco CMS.
The pages available in existing website are almost all static pages..
My question : Is there any way to import these static pages into my Umbraco website.
So that I can skip the manual content creation of these pages in Umbraco.
In short, it depends on how much you need to edit on the original pages and how many pages there are.
If the content is never going to be edited, then you can maybe create most as just normal masterpages (umbraco templates). You can then just add in Navigations and other CMS spec
Or another way of doing it would be to create 1 template and add a big text box to the DocType which you can then paste the HTML into. However this will mean you will end up with loads of HTML in the DB.
If you want to make it a 'true' Umbraco site and use as much of the CMS functionality as possible then there is no really easy way of converting HTML into an Umbraco site.
If the data was in a DB you could use CMSImport and map the old to the new DocType fields, but you would still probably have to do some HTMLTidy work on it before importing.
Depending on the amount of pages, the best and easiest way is usually to just copy and paste in my opinion because it allows you the chance to perform a content audit at the same time and clean up HTML where necessary.
I did this before.
Created a basic template / view with header and footer and main content area.
Then use Screaming Frog (or a similar tool) to crawl the site.
Use the output of the page crawl to make a comma delimited list of Urls
then use this to find each page.
For each page, create an Umbraco page with the name of the url, ie /something-page-name = 'Something Page Name' Use HTML Agility pack to navigate the HTML and pull out key elements such as Title, Description etc and locate the main content by navigating the DOM and literally take the InnerHTML of that section into the content field of the Umrbaco page and save and publish it.
Make sure you allow your content editor in Umbraco to edit all the html elements found in the source page. Ie you may have section or small tags which the editor may not recognise.

How to make the parts of my web page editable in ASP.Net?

I have requirement to make parts of a dynamic web page that includes header, footer, menu, content and buttons. I require all of them to be editable/non-editable once i turn on/off editing from admin side.
I already know that DotNetNuke already does that for the developer. I like to know what are the merits and demerits if we do it without using DNN. I like to discuss this. Thanks
Actually this dynamic editing is done with javascript on client side.
I can suggest a nice jQuery code that make editable part of the page with a click. The rest is to handle the save of this edit using some ajax calls. Very nice and simple
Look here a working demo :
http://www.appelsiini.net/projects/jeditable/custom.html
and get the code from:
http://www.appelsiini.net/projects/jeditable
Take a look at ASP.NET Web Parts.
MSDN quote:
In a Web application scenario, you could offer a complete solution for end users to manage and personalize the application. This could include a set of Web Parts controls that provide the desired features for the site, a consistent set of themes and styles that allow end users to personalize the UI in a consistent way, catalogs of Web Parts controls from which users can select the ones they want to appear on a page, authentication services, and role-based management (for example, allowing administrative users to personalize Web Parts controls and site settings for all users).

ASP.NET - best method for website where user can create articles (like a blog)

I'm an ASP.NET newbie, but not so new at programming in general.
I'm creating a commercial website, and I want to allow an admin to add new articles (an article consists of text, images and various properties such as category).
I am trying to decide the optimal Modus Operandi. This site is commercial, so SEO is a major consideration. This means that I want each url to be "unique". That is, if someone navigates to an article about raccoons, he should be redirected to www.mysite.com/articles/raccoons. This means - I can't have one page that loads the appropriate article dynamically a-la AJAX (gotta use deep-linking)
So how exactly do I do this? suppose the admin entered his text, uploaded the images and set the article properties. I create a new subfolder, save the images to the server (I understand that saving images to a DB is a big no-no), their addresses in a DB, and the content itself to the DB. But now what?
How do I go about creating the actual page?
Is there a function for creating a new aspx file? then what about its corresponding cs file? Or is it unwise to use aspx? Maybe plain html? but then how does it work with my site's master page? Or maybe just create another copy of a general aspx file which is populated with an article according to a parameter?
I would like to know what is the "smartest" approach before I dive in too deep.
You can Consider ASP.Net MVC for this. What you need is more like a Content Management System rather than a Blog, as you mentioned an administrator will add articles.
By Using ASP.Net MVC, you have a very clean implementation there, your urls will stay as you need it for SEO, You dont have to create aspx pages on the fly but the framework will let you deal with new urls from your class files.

How to create dynamic views in asp.net mvc?

How to create dynamic views in asp.net mvc 2.0?
A better way to think about this is to have a generic view page that renders some HTML that administrator defines and which gets stored in a database. Another alternative would be to create static HTML files -- assuming the content is fixed or could be retrieved via AJAX -- and have a view which dynamically chooses which of these HTML files to from your generic view. I use this latter method to make certain parts of a link aggregator site I've put together maintainable by others. It renders HTML fragments (stored in content/static/*.htm) onto fixed parts of the index page/view using jQuery load. The admins have access to modify these files to rearrange/add/delete the links contained on that part of the page. The app is at an early stage of development and eventually these will migrate either into configuration files, and I will generate the HTML, or perhaps I'll develop an administrative interface to manage them and keep them in the DB.

Resources