Chorn Sokun's Weblog

Conquer inner fear, push it to the limit!

Posts Tagged ‘Localization

Khmer Localization with .NET

leave a comment »

Localization in .NET doesn’t seem to solve a lot of problem in theory but I get no luck to get it work, although I built a custom Culture and having the resource file embedded in the assembly it just WON’T WORK !

After look around for solution I decided to give up and cheat a bit building localization engine from scratch is not too difficult but I tend not to spend my time on this yet.

So here is my way to have bilingual UI (Khmer & English)
resource

by faking treat fr-FR == km-KH and that work !

Never die with your tool, exercise your brain ;)

Advertisements

Written by Chorn Sokun

October 1, 2009 at 9:10 am

Posted in Programming, Tips & Tricks

Tagged with ,

Surprise !

with 5 comments

It amazes to see how people taking their value time and energy try to make the different, somehow I was not expected this phenomenon to growth that much in Cambodia but the truth is Cambodian make a different.

Ladies & Gentlemen, Boys & Girls watch out !

Programming Localization

Syntax Localization

At the movement of posting I am not clear who behind this project… but, you guy made something that turn my morning into

Congratulation! now let open our discussion will this thing change Cambodian development climate what are your pros & cons?

Written by Chorn Sokun

October 11, 2008 at 9:35 am

ASP.NET Globalization & Localization Take #2

leave a comment »

In my previous post “.Net 2.0 App_GlobalResources within VS.NET 2008” I was successfully manipulate string stored in satellite assembly that was the isolation test to make sure that thing work. 

ASP.NET Web Application Basic Structure

ASP.NET Web Application Basic Structure

The next move is to integrate the technique with my MonoRail solution. In theory the trick should work like magic;

Castle Basic Structure

Castle Basic Structure

BUT nope I got nothing in return I verify the satellite assembly through Reflection nothing different. So what the heck is going on ???

Now take a look at how I solved the mismatch:

ASP.NET Web Application

ResourceManager rm = new ResourceManager(
   "Web.Applications2.Strings", Assembly.GetExecutingAssembly());

Castle.MonoRail

ResourceManager rm = new ResourceManager(
   "Basic.Web.Resources.Strings", Assembly.GetExecutingAssembly());

Can you spot the different?

Written by Chorn Sokun

September 10, 2008 at 2:03 pm

.Net 2.0 App_GlobalResources within VS.NET 2008

with one comment

If you ever done globalization & localization your web application/website you must have appreciated  the way Microsoft approach the problem through App_LobalResources as well as App_GlobalResources. However since I am not a WebForm’s fan App_LocalResources is not my friend but App_GlobalResources.

Not until I recently had to Rebuild my web application within VS.NET 2008 and it complains about resources name already defined ???? What the heck !

The namespace 'Resources' already contains a definition ...

CS0101: The namespace 'Resources' already contains a definition for 'Messages'

I fired up Firefox searching the entire net and yeah I am not the only one experience the pain but none of their suggestion would work for me. Well most of them advice to remove the resources file and keep a single of them “fall back resource” but hell that will make localization suck what the point?

But I remembered, I didn’t have this kind of problem in previous version of the IDE? How about trying that one more time? ack I no longer had a copy of VS.NET 2005 installed fine call a friend get sharing his laptop view via Microsoft SharedView and mess around; finally I can confirm that it everything work perfectly so it must be the “VS.NET 2008”

The last thing I did was load my solution under vs.net 2008 and upgrade my web application runtime from 2.0 to 3.5 and recompile the app. again and guess what? IT WORKS !! YEAH and that stressed me out a bit since I did not want to upgrade .net runtime on the server just YET.

Anyway that is my story; do you know a better way to fix the problem without upgrade my web application runtime?

update: the solution above somehow wacky and I got to admit the best way to deal with this is using satellite assembly approach here are a few links:

I  had to use pre-build event to generate necessary satellite assembly like this

cd $(ProjectDir) resgen.exe MyResource.resx
al.exe /t:lib
   /embed:MyResource.resources
   /out:bin\en-GB\$(ProjectName).resources.dll /c:en-GB

resgen.exe MyResource.km-KH.resx $(ProjectName).MyResource.km-KH.resources
al.exe /t:lib
   /embed:$(ProjectName).MyResource.km-KH.resources
   /out:bin\km-KH\$(ProjectName).resources.dll /culture:km-KH

Note: make sure you created bin\en-GB and bin\km-KH before build the project.

Written by Chorn Sokun

September 2, 2008 at 9:13 am