Localization is one of the coolest features in ASP.NET 2.0


To this day I don’t think we talk about the localization story in ASP.NET 2.0 enough — the built in framework really makes it simple to produce a multi-lingual site, the type of thing that would take TONS of code and pain before.  In October we released an article that discusses the system in depth — we updated it today to be inline with RTM and have 3 supplemental papers in the pipeline to continue teaching folks about localization.  If you care about localization at all this is a must read — Expect 1 article every 3-4 weeks on this topic from us, i’ll keep you up to date here.


Read the article at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/asp2local.asp


Comments?  Let me know!

Comments (17)

  1. Bob says:

    This was a nice step for localization, but I don’t understand why they would not support plugging a different provider into the resource manager? As it stands now, unless I am missing something, all of us that store our localized text somewhere besides the resource files are having to write our own resource manager anyhow.

    Bob

  2. Excellent, thanks for posting this Brian.

  3. RSBCTrumpet says:

    This is great, but one question. I have been using localization in ASP.net 2.0 for a while now and love it. My problem is the localization for the reports and reportviewer control. I went to Barnes and Nobles today as well as Borders and looked through EVERY Microsoft ASP.Net 2.0 book and others and not a single one of them had anything about Reports in the index., much less localization! There is very little on MSDN2, and only a few references. I have installed the report viewer reditributable and language pack as well, but still there isn’t any hep! Does anyone know where there might be better information or examples for localizing the buttons on the reportviewer and how to change the textboxes (like global expressions) for the report based on the culture settings?!?! I am very familiar with creating reports, but I need them in Chinese!

    You are correct, we do need to talk about localization more.

    Thanks,

    ~bg

  4. Daniel Piché says:

    Thank’s for the info.

    I’m still looking all over the place for the following:

    Easy to find info on Localizing ASP.NET Web Pages Using Resources…..

    DIDN’T FIND ANY INFO ON:

    Localizing ASP.NET Web SERVICES Using Resource????

    No access to GetGlobalResourceObject() and not abel to create a valid ResourceManager!

    Any idea?

  5. Sunil says:

    The localization feature is great in ASP.Net 2.0.

    But I come across a problem while i was doing a strict test run.

    I a using a Beta copy

    Actually it has changed all the Tab-index settings and also, removed all the settings of onclick event with buttons.

    Any Idea how do i get it back, is a more than 150 controls form.

    Sunil

  6. tec-goblin says:

    This is great, and it comes exactly when I needed it. But I have just one (major it seems) problem:

    I am using Web Developer Express, because here in my university in Lyon they don’t seem to have an MSDN subscription (or if they do have, they hide it really well :P). And I don’t seem to be able to find the "Generate Local Resources" option in the Tool menu. Is it normal for the express version?

    Is there any reasonable workaround on this?

  7. bgold says:

    tec-goblin —

    The Generate Local Resources option is only available in Visual Studio 2005 Standard Edition or greater.  You should find out if your school has MSDN AA because then you could get VS Pro for free.

  8. bgold says:

    sunil — first you shoudl get an RTM version of the product.

    If you right click on the toolbox there should be a reset option of some sort, that should fix it up.

  9. HI I HOPE YOU CAN HELP ME , SO I MAIL YOU OK.

    I HAVE LITLE BIT PROBLEM IN PROGAMING LANGUAGE, I DON’T UNDERSTAND 1 POINT. HOW CAN I USE IN ASP.NET IN VB.NET  THOURGH.

     OK ?

    THANKS

    BYE

  10. Brad says:

    Wow…  I had high hopes for the "improvements" in 2.0 but I’m sorely disappointed.  I actually spent quite a while digging around for articles and examples because I thought "I must be doing something wrong, it can’t really be this much of a pain."

    We’ve got a couple dozen pages which need to support French and English.  Our approach with ASP.NET 1.1 was to simply subclass ‘Page’ and add some language-handling logic.  We could then show/hide certain blocks of HTML depending on the current language.  For PostBack controls (Buttons and the like) we would have an "En" and a "FR" version, but both were hooked up to the same event handler.  Fairly simple to use.  This approach also had a couple of major advantages:

    1) our graphics/layout guy could see both the french and the english content in design view of his editor-of-choice, making it easy for him to make changes to the content.

    2) he could not only change content, but also add new content or remove existing content without the need to recompile, since the plain images and text did not require the "runat="server" attribute.  This type of system allows developers to focus on development work, instead of helping a design guy repeatedly update and redeploy content.

    Adopting 2.0’s approach to localization would be a nightmare.  I cannot picture myself hunting through every shred of HTML we have and making practically everthing into a server control simply because its text, tooltip, image url, css class, etc is language-dependent.  Plus I have to imagine that my new page with 30-odd server controls instead of five or six is going to render a little slower.

    Even if I had the patience for all of this, I would then have to copy my English resx into a French one and painstakingly find and replace each bit of text, (or url, or css class name..) with its french equivalent.

    It sure would be nice if Visual Studio has a bit more built-in support for this type of work.  It would be nice to right-click on a control in design view, choose "Localize" or something, and have a nice GUI window pop up and let me enter values for as many property/language combinations as I want, with the tool automatically writing these to the appropriate resource files for me.

    It would also be nice to be able to change my page’s Culture setting in design view and have all of the appropriate values load from the resource files so I can see my page in French, English, or whatever I want at design time.

    For now I will be content to use something like the MultiView control and simply toggle the French or English content depending on the language.  Localization has a LOOONG way to go before I’m going to use it.

  11. Sommarafton says:

    Hi RSBCTrumpet,

    There is a book on ASP.NET 2.0 called Pro ASP.NET 2.0 in C# 2005 (http://www.apress.com/book/bookDisplay.html?bID=450) which has an example covering the localisation of reports in ASP.NET 2.0 a bit. Its in the Loccalisation chapter. Maybe that can help you, bg.

    Regards,

    Sommarafton  

  12. Olav says:

    I support Brad.  I did it in Windows Forms in/with 2003 – much simpler (in principle).  

    It should be possible to edit different language versions directly in the forms editor.

    (It must really have been bad before for all these people to be so happy …..)

    Olav

  13. Olav says:

    I support Brad.  I did it in Windows Forms in/with 2003 – much simpler (in principle).  

    It should be possible to edit different language versions directly in the forms editor.

    (It must really have been bad before for all these people to be so happy …..)

    Olav