- InternationalizedMvcApplicationPart2.zip
- InternationalizedMvcApplicationPart2
- InternationalizedMvcApplication.sln
- InternationalizedMvcApplication.vsmdi
- InternationalizedMvcApplication
- bin
- ar
- InternationalizedMvcApplication.resources.dll
- bin
- ar
- InternationalizedMvcApplication.dll
- MvcGlobalisationSupport.dll
- Content
- Site.css
- themes
- base
- images
- ui-bg_flat_0_aaaaaa_40x100.png
- ui-bg_flat_75_ffffff_40x100.png
- ui-bg_glass_55_fbf9ee_1x400.png
- ui-bg_glass_65_ffffff_1x400.png
- ui-bg_glass_75_dadada_1x400.png
- ui-bg_glass_75_e6e6e6_1x400.png
- ui-bg_glass_95_fef1ec_1x400.png
- ui-bg_highlight-soft_75_cccccc_1x100.png
- ui-icons_222222_256x240.png
- ui-icons_2e83ff_256x240.png
- ui-icons_454545_256x240.png
- ui-icons_888888_256x240.png
- ui-icons_cd0a0a_256x240.png
- jquery-ui.css
- Controllers
- Global.asax
- Global.asax.cs
- InternationalizedMvcApplication.csproj
- InternationalizedMvcApplication.csproj.user
- Models
- obj
- Properties
- Resources
- Scripts
- Views
- Web.config
- Web.Debug.config
- Web.Release.config
- Local.testsettings
- MvcGlobalisationSupport
- MvcGlobalisationSupportTests
- TestResults
- Krith_KEITH-LAPTOP 2011-06-01 09_23_17.trx
- Krith_KEITH-LAPTOP 2011-06-01 09_23_43.trx
- TraceAndTestImpact.testsettings
- InternationalizedMvcApplicationRazorPart2.zip
- InternationalizedMvcApplicationRazorPart2
- InternationalizedMvcApplicationRazor.sln
- InternationalizedMvcApplicationRazor
- bin
- ar
- InternationalizedMvcApplicationRazor.resources.dll
- bin
- ar
- InternationalizedMvcApplicationRazor.dll
- MvcGlobalisationSupport.dll
- Content
- Site.css
- themes
- base
- images
- ui-bg_flat_0_aaaaaa_40x100.png
- ui-bg_flat_75_ffffff_40x100.png
- ui-bg_glass_55_fbf9ee_1x400.png
- ui-bg_glass_65_ffffff_1x400.png
- ui-bg_glass_75_dadada_1x400.png
- ui-bg_glass_75_e6e6e6_1x400.png
- ui-bg_glass_95_fef1ec_1x400.png
- ui-bg_highlight-soft_75_cccccc_1x100.png
- ui-icons_222222_256x240.png
- ui-icons_2e83ff_256x240.png
- ui-icons_454545_256x240.png
- ui-icons_888888_256x240.png
- ui-icons_cd0a0a_256x240.png
- jquery-ui.css
- Controllers
- Global.asax
- Global.asax.cs
- InternationalizedMvcApplicationRazor.csproj
- InternationalizedMvcApplicationRazor.csproj.user
- Models
- obj
- Properties
- Resources
- Scripts
- Views
- Web.config
- Web.Debug.config
- Web.Release.config
- MvcGlobalisationSupport
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Routing;
namespace MvcGlobalisationSupport
{
public class CultureRouteConstraint : IRouteConstraint
{
// To only allow *supported* cultures as the first part of the route, instead of anything in the format xx or xx-xx comment the lower method
// and uncomment this one, and make CultureManager.CultureIsSupported public.
//public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
//{
// if (!values.ContainsKey(parameterName))
// return false;
// string potentialCultureName = (string)values[parameterName];
// return CultureManager.CultureIsSupported(potentialCultureName);
//}
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
{
if (!values.ContainsKey(parameterName))
return false;
string potentialCultureName = (string)values[parameterName];
return CultureFormatChecker.FormattedAsCulture(potentialCultureName);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I Graduated in Natural Sciences (Chemistry & Physics) from Durham University, where I did not cover myself with glory, but did fill, and often cover, myself with beer.
I qualified as a secondary school teacher, but I
hated teaching. I worked as an IT techhie for a few years but kept being promoted to IT Trainer, thanks to my teaching experience, which I also disliked. I spent some time working out what else I could do instead and reduced beer intake.
I realised that I should work as a programmer, having enjoyed it a hobby since I was a nipper in the halcyon days of the Sinclair Spectrum (48k, Rubber Keyboard). Spent
two weeks working out why I didn't think of this to start with, instead of starting my dull-as-ditch-water Chemistry degree 8 years earlier. Had a beer to celebrate.
I Graduated in 2001 with an MSc from Newcastle Uni in Comp Sci. Did cover myself with glory, and drank some beer.
.Netting ever since, and loving it. Though I have largely given up beer due to not being able to hack the pace like I used to.
I was born, brought up, and have lived most of my life near Newcastle. In a fit of temporary insanity I moved to Amman, in my wife's homeland of Jordan, but made it back safely to the UK without any extra holes being made in my person by bullets. To be fair it was pretty safe at the time, if you ignored the roads.
Visit Jordan if you can by the way, the landscape is beautiful and varied, the food excellent and the people the friendliest on earth, after Geordies naturally
.