locked
Best Practices (Visual Web Developer 2005) RRS feed

  • Question

  • User-1607204770 posted
    Greetings,


    Considering the features of Visual Web Developer, what would be the best practices for localizing a web site that is not very big be must be available in about 10 lamguages ?

    I took a few HOURS to read the entire Site localization - best approach? thread. I was glad to find it since i was looking for informations about this very subject !

    After reading it, i am now more confused than ever.

    I was glad to see that we could generate resource files so i started to build the entire site. When i was ready to generate the local resource files, i realized that only the resources for the controls were generated.... nothing for the regular html text.

    What about the ASP:LOCALIZE class ?  Can it consume too much CPU ?

    Thanks in advance !

    Tuesday, November 29, 2005 8:11 PM

All replies

  • User1183903743 posted

    After reading it, i am now more confused than ever.
    Out of the depths of confusion comes realization!


    Site localization - best approach? is not a beginner thread, although if you only concentrate on the explanations of the mechanism, and not the architecture stuff, you will learn a lot. If the site is not very big use the standard approach best described here
    The need for some of the improvement will only become evident after you do a couple of sites.
    only the resources for the controls were generated.... nothing for the regular html text.
    asp.net localization is a SERVER technology. asp.net parser(all server parsers cold fusion, jsp, php for that matter) skips over static markup like html for any server processing including localization. Why would you expect that?
    What about the ASP:LOCALIZE class ?  Can it consume too much CPU ?
    I suggest you reread the thread. You will find that NONE of the compiled literals(Localize.Text is definitely included) take any more CPU as they are all compiled in different assemblies, and ONLY one of those assemblies kick in at a time, depending on the culture of the thread.

    The Localize control is a hybrid between Label and Literal the major difference being that the literal does not show on the designer surface of the IDE and the Localize does. At runtime they render the same resourced literal. In a way the Localize is exactly what you are looking for for static text. Again, it is still a SERVER control.

    One other major point that Michelle Bustamente made is that localization is simplified but NOT SIMPLE. The minute you say the L word and all complexity goes on steroids.

    That thread is mostly about architecture. One of your biggest problems would be encodings.

    There is a whole HUGE side of design that involves linguistics we didn't even get into, either. The ONE page template for ALL languages is a very demanding CENTRIC one. That means that you must structure your literals and the layout to accomodate all languages. German has very long words, English has a no cases, no inflections, no gender and therefore only strict word order. Other languages do not. Spanish and French have subjuctives, Russian has inflections and cases. I won't even go near RTL here.

    For example you cannot do this:

    String.Format(@"You can <a href='~/answer.aspx'>click</a> on {0}'s question", User.Name);

    You must make it equally clunky in all languages:

    String.Format(@"<a href='~/answer.aspx'>Click on the question of user: {0} </a>", User.Name);

    No concatenation, no presumption of word order, the visible part of the literal(red) is ONE entity. The dynamic part(blue) is separate and allows for all kinds of gender, case, inflection, prefix, suffix variations.


    So you must do quite a bit of preparation before you just point and click your way into a nightmare.

    Good luck.


    Tuesday, November 29, 2005 9:30 PM
  • User-1607204770 posted
    Thanks for your comments rmprimo,

    I know quite a lot in terms of localization since i've been in the software engineering business for more than 10 years now but i am not the best expert in web stuff and i am more than new to Visual Web Developer.

    About my original quiry, can i use asp:localize even if the text contains some formating tags... <H2>, <strong> etc...  The documentation seams to discourage this... how is it used on the field... Is it realy not a recommendeable practice ?
    And how can we localize menus ?... I have a master page containing an asp:menu control.... It generates resource keys for the menu itself but nothing for its items. (Which make sense since they come from a Web.sitemap xml file...)

    Thanks !

    Aco.

    Tuesday, November 29, 2005 9:51 PM
  • User1183903743 posted
    About my original quiry, can i use asp:localize even if the text contains some formating tags... <H2>, <strong> etc...  The documentation seams to discourage this... how is it used on the field... Is it realy not a recommendeable practice ?
    There is no reason to include the tags. This is how you use it.

    <
    h3><asp:Localize runat="server" ID="loc1">Localized snippet of text</asp:Localize></h3>

    After running the GLR it was converted to:

    <h3><asp:Localize runat="server" ID="loc1" meta:resourcekey="loc1Resource1" Text="Localized snippet of text" /></h3>

    Frankly, there is no difference between the Localize and the Literal. Localize inherits from Literal without adding ANY new or different members. So why does it even exist? I presume there are System.ComponentModel attributes that are different. If you plan to use it in code there is no difference. I never use it at all and don't miss it.


    And how can we localize menus ?... I have a master page containing an asp:menu control.... It generates resource keys for the menu itself but nothing for its items. (Which make sense since they come from a Web.sitemap xml file...)


    I don't think you can do local resources with the menu. It can be much more hierarchical than the rest of the controls. So the GLR won't work on that.

    You would have to do global resources for the text, tooltip, img urls etc. You can either assign them in code(strongly typed Resources) or use global expressions in the menu markup.

    I don't use the asp:menu. It does not support css well and has a poor client object model. There are much nicer 3rd party ones that can take a nodeset for the data. IMO that is how menu localization should be done: just hydrate it with a different xml doc.

    HTH!

    Wednesday, November 30, 2005 12:36 AM