ASP.NET is one of the most common web application development platforms. As with any other .NET framework application, ASP.NET provides great support for localization and globalization straight out of the box. Following best practices from the beginning of development will result in a properly internationalized application, making ASP.NET application localization an enjoyable process. In order to save money, reduce localization/internationalization defects and shorten the time to market, it’s important to consider localization as part of the development process.
ASP.NET Application Localization: What Needs to be Localized/Translated?
In a typical ASP.NET application, the following four items may differ depending on the user’s language and regional preferences:
- Text resources – The text that resides in the aspx page. Both asp server tags and traditional html tags may contain text on an aspx page. This includes the UI text that may appear in C-Sharp(C#) and Visual Basic code behind files.
- Database content – Most of the translatable text resides in a database for a typical ASP.NET application particularly in content management systems (product information, articles etc.).
- Images and graphics – Graphics and images may contain translatable text.
- Regional options – Date/time, currency, number/decimal formatting will vary depending on the user’s region and/or preferences.
All text resources should be externalized to resx files in order to make translation and maintenance easier. Also known as “resources file”, a resx file consists of XML entries which specify objects and strings. Visual Studio does provide an automated way to externalize the strings after the page has been created but this function is limited. It only works on the server tags on aspx pages. Visual Studio cannot externalize the text in CS/VB code or process regular html tags.
The best approach is to externalize the tags as the pages are being developed. More information on the use of resx files for ASP.NET localization can be found on MSDN.
The database schema and relations will have to be carefully designed to externalize translatable text to a table(s) which maps to languages and parent tables. Although adding additional columns to existing tables for each language may seem easier; maintenance of this solution is extremely difficult and not recommended.
Images and Graphics
If possible, try avoiding images and graphics with embedded text. Using background images and retrieving the text from a resource file will make the localization effort much easier. If that is not possible, point the source of the image to the resx file which will let you easily change it depending on the language. This applies to other external assets such as pdf and doc files as well.
As in any other programming language and platform, avoid manually formatting and hard coding date/time and number formats. .NET offers a CultureInfo class which provides access to culture-specific instances of objects such as: DateTimeFormatInfo and NumberFormatInfo. Using these objects, culture-specific operations can be performed easily such as formatting dates and numbers, casing and comparing strings.
SaaS Localization: Everything You Need to Know
As a SaaS company grows from startup to global conglomerate, it’s critical to adapt your product to a dive...
Globalize Your Customer Support with a Localized Chatbot
Does your chatbot sound like it’s from another country? Make your bot part of every customer’s community, ...