Thursday, January 22, 2009

Going Multi-Lingual With Parallel Folders in ASP.NET

As with any other programming problem, there are many ways to go about serving pages in multiple language to your visitors. The approach I'm trying out is using a folder for each language (EN, HI etc) and getting pages from both folders to point to the same code behind file. ASP.NET does require you to place the code behind file outside the App_Code folder, which did seem a little odd to me at first.

In the end, I ended up with a folder structure a little like this:
en
--Admin
----Console.aspx
--User
----Listing.aspx
hi
--Admin
----Console.aspx
--User
----Listing.aspx
CodeBehind
--Admin
----Console.cs
--User
----Listing.cs

You might want to try the globalization & localization features in ASP.NET. They are totally awesome when you don't need to change the look of a page by much (think about changing left-to-right to right-to-left) when displaying the same page in a different language.

1 comment:

Josh Berke said...

Interesting idea, Although I'd probally combine the two approaches. Latin based languages should all work with the same layout.

Where as Arabic, Hewbrew and other RtL languages should all work fine together. So you can have two different layouts each their own resource files.

Now can this be accomplished with Skinning & Themes?