.comment-link {margin-left:.6em;}
Books & Articles I wrote.

Wednesday, May 10, 2006


Localizing ASP.Net 2.0 Web Apps

I woke up at 5 Am this morning fairly sane. By 7AM i was in the street, naked, talking Japanese (which i don't speak a word of) to small invisible snakes.

Why? Because of ASP.Net 2.0 resource files. They are NUTS and really need to be made easier. If you are localizing your web app then you can use resource files in .Net to take care of the correct ouput. Let's skip that though and get to the crux of the problem and how i solved it.

You can just creat a resx file in the App_GlobalResources directory and ASP.Net takes care of it for you. BUT, if you want to programatically access that resource file you are in for a headache and it is a dynamic assembly and so you don't actually know the full namespace until compile time (and then it's too late - i'd be interested if anyone used reflection successfully to get the dynamic namespace and loaded the resource file). Quite simply i tried a few things and then stopped, deciding there must be an easier way. You see i wanted to do this :


I just kept getting this :

Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.baseName: BlahResources locationInfo: fileName: BlahResources.resources

I'm sure it worked the first time - seems so long ago that i can't be sure anymore. Anyway, I followed a host of sites saying "add the project name" - well because the aseembly is dynamically compiled then you cannot state what the final name will be. So none of these "solutions" were working (i think most applied to .Net 1.x to be honest).

So here is my solution:

1. Create a .resx file and add your localized data in the normal way. Create a neutral file and then language specific files as desired (myresource.resx, myresource.en.resx, myresource.es.resx ...)

2. *Important* - Compile each resx file to a .resources file using ResGen.exe.

3. Place this .resources file in some other directory (say a "resources" directory).

4. In CreateFileBasedResourceManager() reference the .resources file location.

CreateFileBasedResourceManager("MyResource", Server.MapPath("/resources"), null);

That's it - it should work fine now. That gotta make this easier!

 read 0 comments | 

Consumer companies that "get it"

Here is a list of "to be expanded" companies that target consumers are are very usable. That it, your mum/mom would (a) want to and (b) be able to use it.

1. Google - type in some text and click go - my mum uses it
2. Pando - very easy to send large media files to friends and family
3. Hotmail / GMail - both are used by non-techhie members of my family

 read 0 comments | 

Real-time Mapping

This is an interestig article about MIT's involvemtn of real-time location aware services at senseable.

"That's the basics, but what is more interesting, when you see all the dynamics of the city in real time, is not only to optimize your trip but also to really get the pulse of the city -- you can see where people are, where you can go and get a drink. Maybe you can also see tourists and the concentration of different nationalities in the city."

 read 0 comments | 

This page is powered by Blogger. Isn't yours?

Weblog Commenting and Trackback by HaloScan.com