In this tutorial, you will learn how to add custom localization to AJAX Control Toolkit.
To learn how to install the toolkit, see the
Step-by-Step Installation Guide
is the name of a locale for which you are providing resources.
For the Russian locale, this object is named
The hash object structure matches the structure in built-in localization files and contains a subset of the
hash object (defined in AjaxControlToolkit.Scripts.Localization.Resources.js
) with key-value pairs that should be overridden for a particular culture.
For example, if you want to localize only the Calendar_Today
entry, your hash object will contain a single entry with the
key and a value with a translation for your locale.
, while a release version ends with .min.js
(Visual Studio 2013 or earlier) or
Bundler & Minifier
extension (Visual Studio 2015).
Mark localization files as Embedded Resource
Localization files will be stored in your assembly, so you don’t need to write any custom HTTP-handlers to retrieve them.
Set these files’ Build Action to Embedded Resource
Add WebResource attribute for every localization file
Storing resources in an assembly does not mean that they will be available outside this assembly by default. To expose any embedded resource to web clients, you need to add the WebResource attribute for every localization file. This attribute is applied to
an assembly scope.
The attribute constructor requires two parameters:
is the name of a Web resource embedded into an assembly.
For example, if you have embedded resources into an assembly named MyAssembly.MyLocalization.js
, the attributes will be as follows:
Register custom localization
Custom localizations are registered with the Localization.AddLocale()
static method, which requires three attributes:
is a locale name, like “en”, “de”, “fr”, etc.
is an assembly that contains a localization file.
For example, registering MyAssembly.MyLocalization.js
for the Italian locale will be as follows:
Localization.AddLocale("it", "MyAssembly.MyLocalization", Assembly.GetExecutingAssembly());
This method can be called anytime, but the most convenient place is the Application_Start()
method in the Global.asax file.
Overriding built-in localizations
You can override any localization that is built into AJAX Control Toolkit with your custom localization by providing the same
when calling the Localization.AddLocale()
For example, if you want to override the Korean localization, pass “ko” as the first parameter:
Localization.AddLocale("ko", "MyAssembly.MyLocalization", Assembly.GetExecutingAssembly());