Home > ASP.NET > C#: Language not supported in Ajax Control Toolkit? No problem, do localization by yourself

C#: Language not supported in Ajax Control Toolkit? No problem, do localization by yourself

In my projects I often have to implement user interface in two languages: English and Polish. Although localization in .NET is quite easy, one thing was annoying to me: AjaxControlToolkit doesn’t support Polish language.

When my user choose Polish language on the webpage then he still see in Calendar control ‘Today’ word instead Polish version (‘Dzisiaj’). Same thing for several other controls, for example PasswordStrength control. So one day I decide to correct this once and for all. Below I will show you how to localize Ajax Control Toolkit.

To localize AjaxControlToolkit to our langauge (Culture) we will have to do few simple steps. In below examples I use library version for .NET 2.0 but the same steps are in case of Ajax Control Toolkit for .NET 3.5

First step, download library source from http://ajaxcontroltoolkit.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=27326

Unzip, and open in Visual Studio AjaxControlToolkit project which is located in directory AjaxControlToolkit in zip file.

localize_ajaxtoolkit_1

Make a copy of ScriptResources.resx resource file (this is a English culture).  Rename it to your culture. For example, Polish culture is pl-PL so the filename will be ScriptResources.pl.resx (I will use this name in all examples)

localize_ajaxtoolkit_2

Open ScriptResources.pl.resx file and translate everything or just particular sentences.

localize_ajaxtoolkit_3

When you finish, choose from menu Unload Project

localize_ajaxtoolkit_4

and edit project file

localize_ajaxtoolkit_5

Find the line:

    <EmbeddedResource Include="ScriptResources\ScriptResources.pl.resx">
      <SubType>Designer</SubType>
    </EmbeddedResource>

Change to:

    <EmbeddedResource Include="ScriptResources\ScriptResources.pl.resx" Condition=" '$(Configuration)'=='Release' ">
      <SubType>Designer</SubType>
    </EmbeddedResource>

localize_ajaxtoolkit_6
If you don’t use other languages then you can safely delete all other resource references (except English and your Culture) like Portugal for example:

    <EmbeddedResource Include="ScriptResources\ScriptResources.pt.resx" Condition=" '$(Configuration)'=='Release' ">      <SubType>Designer</SubType>    </EmbeddedResource>

localize_ajaxtoolkit_7
You can always add them in the future. Save changes and Reload project:
localize_ajaxtoolkit_8
Now a little bit of cosmetic (you don’t have to do that but I recommend it for better organization). Go to Project Properties, choose from left menu, Build and change Confguration to Release. Change Output Path for some new folder. Save changes.
localize_ajaxtoolkit_9
Ok, we almost finished. Now, compile project in Release mode. localize_ajaxtoolkit_10
As a result you will find in output directory our localized AjaxControlToolkit library.
localize_ajaxtoolkit_11
localize_ajaxtoolkit_12

We can add it to our Visual Studio toolbox:
localize_ajaxtoolkit_13
If we drag any control to our page then AjaxControlToolkit library will be copied to our bin project directory. For existing projects we have to delete old reference and add our localized version.
localize_ajaxtoolkit_14
That’s all, we have Polish language in Ajax Control Toolkit. No more exceptions like ‘Today’ word in Calendar control and other english words in our well localized ASP.NET application :)

Additional information about toolkit localization: http://www.codeplex.com/AjaxControlToolkit/Wiki/View.aspx?title=Localization
Share and Enjoy:
  • DotNetKicks
  • Digg
  • del.icio.us
  • Wikio IT
  • Google Bookmarks
  • Facebook
  • Print
Categories: ASP.NET Tags: ,
  1. October 5th, 2009   (Quote) at 00:35   (Quote) | #1

    wow! that’s realy cool story!!! thanks

  1. at | #1

Subscribe without commenting