[{"data":1,"prerenderedAt":1057},["ShallowReactive",2],{"blog:2006:globalising-net-web-applications":3,"blogMore-Development":907,"comments-globalising-net-web-applications":920},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"category":11,"tags":12,"excerpt":18,"body":41,"_type":899,"_id":900,"_source":901,"_file":902,"_stem":903,"_extension":904,"url":905,"wordCount":906,"minutes":290,"commentCount":234},"/blog/2006/globalising-net-web-applications","2006",false,"en","Localizing .NET web applications","It seems that globalization often makes the wish list of many a web site until the client realizes professional quality translations require a significant investment of time and money.","2006-11-04T23:29:00+00:00","Development",[13,14,15,16,17],".NET","ASP.NET","WebForms","webdev","globalization",{"type":19,"children":20},"root",[21,28],{"type":22,"tag":23,"props":24,"children":25},"element","p",{},[26],{"type":27,"value":9},"text",{"type":22,"tag":23,"props":29,"children":30},{},[31,33,39],{"type":27,"value":32},"On occasion however smaller web applications with their limited vocabulary are prime targets for ",{"type":22,"tag":34,"props":35,"children":36},"s",{},[37],{"type":27,"value":38},"localization",{"type":27,"value":40}," globalization and it can be feasible to translate the couple of hundred strings involved.",{"type":19,"children":42,"toc":889},[43,47,56,61,68,82,88,93,297,303,316,391,396,472,478,483,551,556,621,645,651,656,661,804,809,822,828,833,838,843,849,854,859,865,870,875,883],{"type":22,"tag":23,"props":44,"children":45},{},[46],{"type":27,"value":9},{"type":22,"tag":23,"props":48,"children":49},{},[50,51,55],{"type":27,"value":32},{"type":22,"tag":34,"props":52,"children":53},{},[54],{"type":27,"value":38},{"type":27,"value":40},{"type":22,"tag":23,"props":57,"children":58},{},[59],{"type":27,"value":60},"Here’s a very brief whirlwind overview of what’s involved.",{"type":22,"tag":62,"props":63,"children":65},"h2",{"id":64},"create-the-default-language-resource-file",[66],{"type":27,"value":67},"Create the default language resource file",{"type":22,"tag":23,"props":69,"children":70},{},[71,73,80],{"type":27,"value":72},"Create a new folder inside your App_GlobalResources folder to contain your language resource files. Then create a new resource file (e.g. ",{"type":22,"tag":74,"props":75,"children":77},"code",{"className":76},[],[78],{"type":27,"value":79},"Localization\\Language.resx",{"type":27,"value":81},") to use when no translation exists for the user’s preferred language.",{"type":22,"tag":62,"props":83,"children":85},{"id":84},"detect-the-users-browser-settings-and-switch",[86],{"type":27,"value":87},"Detect the user’s browser settings and switch",{"type":22,"tag":23,"props":89,"children":90},{},[91],{"type":27,"value":92},"In .NET 1.1 this required a couple of lines of code in your global.asa.cs:",{"type":22,"tag":94,"props":95,"children":100},"pre",{"className":96,"code":97,"language":98,"meta":99,"style":99},"language-csharp shiki shiki-themes everforest-light dracula","public void Application_BeginRequest(object sender, EventArgs e) {\n    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);\n    Thread.CurrentThread.CurrentUICulture = new CultureInfo(Request.UserLanguages[0]);\n}\n","csharp","",[101],{"type":22,"tag":74,"props":102,"children":103},{"__ignoreMap":99},[104,166,232,288],{"type":22,"tag":105,"props":106,"children":109},"span",{"class":107,"line":108},"line",1,[110,116,122,128,134,139,145,150,156,161],{"type":22,"tag":105,"props":111,"children":113},{"style":112},"--shiki-default:#F57D26;--shiki-dark:#FF79C6",[114],{"type":27,"value":115},"public",{"type":22,"tag":105,"props":117,"children":119},{"style":118},"--shiki-default:#3A94C5;--shiki-dark:#FF79C6",[120],{"type":27,"value":121}," void",{"type":22,"tag":105,"props":123,"children":125},{"style":124},"--shiki-default:#8DA101;--shiki-dark:#50FA7B",[126],{"type":27,"value":127}," Application_BeginRequest",{"type":22,"tag":105,"props":129,"children":131},{"style":130},"--shiki-default:#5C6A72;--shiki-dark:#F8F8F2",[132],{"type":27,"value":133},"(",{"type":22,"tag":105,"props":135,"children":136},{"style":118},[137],{"type":27,"value":138},"object",{"type":22,"tag":105,"props":140,"children":142},{"style":141},"--shiki-default:#5C6A72;--shiki-default-font-style:inherit;--shiki-dark:#FFB86C;--shiki-dark-font-style:italic",[143],{"type":27,"value":144}," sender",{"type":22,"tag":105,"props":146,"children":147},{"style":130},[148],{"type":27,"value":149},", ",{"type":22,"tag":105,"props":151,"children":153},{"style":152},"--shiki-default:#3A94C5;--shiki-default-font-style:inherit;--shiki-dark:#8BE9FD;--shiki-dark-font-style:italic",[154],{"type":27,"value":155},"EventArgs",{"type":22,"tag":105,"props":157,"children":158},{"style":141},[159],{"type":27,"value":160}," e",{"type":22,"tag":105,"props":162,"children":163},{"style":130},[164],{"type":27,"value":165},") {\n",{"type":22,"tag":105,"props":167,"children":169},{"class":107,"line":168},2,[170,175,181,186,191,196,201,206,211,216,221,227],{"type":22,"tag":105,"props":171,"children":172},{"style":130},[173],{"type":27,"value":174},"    Thread.",{"type":22,"tag":105,"props":176,"children":178},{"style":177},"--shiki-default:#35A77C;--shiki-dark:#F8F8F2",[179],{"type":27,"value":180},"CurrentThread",{"type":22,"tag":105,"props":182,"children":183},{"style":130},[184],{"type":27,"value":185},".",{"type":22,"tag":105,"props":187,"children":188},{"style":177},[189],{"type":27,"value":190},"CurrentCulture",{"type":22,"tag":105,"props":192,"children":193},{"style":112},[194],{"type":27,"value":195}," =",{"type":22,"tag":105,"props":197,"children":198},{"style":130},[199],{"type":27,"value":200}," CultureInfo.",{"type":22,"tag":105,"props":202,"children":203},{"style":124},[204],{"type":27,"value":205},"CreateSpecificCulture",{"type":22,"tag":105,"props":207,"children":208},{"style":130},[209],{"type":27,"value":210},"(Request.",{"type":22,"tag":105,"props":212,"children":213},{"style":177},[214],{"type":27,"value":215},"UserLanguages",{"type":22,"tag":105,"props":217,"children":218},{"style":130},[219],{"type":27,"value":220},"[",{"type":22,"tag":105,"props":222,"children":224},{"style":223},"--shiki-default:#DF69BA;--shiki-dark:#BD93F9",[225],{"type":27,"value":226},"0",{"type":22,"tag":105,"props":228,"children":229},{"style":130},[230],{"type":27,"value":231},"]);\n",{"type":22,"tag":105,"props":233,"children":235},{"class":107,"line":234},3,[236,240,244,248,253,257,263,268,272,276,280,284],{"type":22,"tag":105,"props":237,"children":238},{"style":130},[239],{"type":27,"value":174},{"type":22,"tag":105,"props":241,"children":242},{"style":177},[243],{"type":27,"value":180},{"type":22,"tag":105,"props":245,"children":246},{"style":130},[247],{"type":27,"value":185},{"type":22,"tag":105,"props":249,"children":250},{"style":177},[251],{"type":27,"value":252},"CurrentUICulture",{"type":22,"tag":105,"props":254,"children":255},{"style":112},[256],{"type":27,"value":195},{"type":22,"tag":105,"props":258,"children":260},{"style":259},"--shiki-default:#F85552;--shiki-dark:#FF79C6",[261],{"type":27,"value":262}," new",{"type":22,"tag":105,"props":264,"children":265},{"style":152},[266],{"type":27,"value":267}," CultureInfo",{"type":22,"tag":105,"props":269,"children":270},{"style":130},[271],{"type":27,"value":210},{"type":22,"tag":105,"props":273,"children":274},{"style":177},[275],{"type":27,"value":215},{"type":22,"tag":105,"props":277,"children":278},{"style":130},[279],{"type":27,"value":220},{"type":22,"tag":105,"props":281,"children":282},{"style":223},[283],{"type":27,"value":226},{"type":22,"tag":105,"props":285,"children":286},{"style":130},[287],{"type":27,"value":231},{"type":22,"tag":105,"props":289,"children":291},{"class":107,"line":290},4,[292],{"type":22,"tag":105,"props":293,"children":294},{"style":130},[295],{"type":27,"value":296},"}\n",{"type":22,"tag":62,"props":298,"children":300},{"id":299},"update",[301],{"type":27,"value":302},"Update",{"type":22,"tag":23,"props":304,"children":305},{},[306,308,314],{"type":27,"value":307},"Sander Rijken points out that .NET 2.0 lets you do this with a line in your web.config ",{"type":22,"tag":74,"props":309,"children":311},{"className":310},[],[312],{"type":27,"value":313},"\u003Csystem.web>",{"type":27,"value":315}," section instead:",{"type":22,"tag":94,"props":317,"children":321},{"className":318,"code":319,"language":320,"meta":99,"style":99},"language-xml shiki shiki-themes everforest-light dracula","\u003Cglobalization culture=\"auto\" uiCulture=\"auto\" />\n","xml",[322],{"type":22,"tag":74,"props":323,"children":324},{"__ignoreMap":99},[325],{"type":22,"tag":105,"props":326,"children":327},{"class":107,"line":108},[328,334,338,344,349,355,361,365,370,374,378,382,386],{"type":22,"tag":105,"props":329,"children":331},{"style":330},"--shiki-default:#8DA101;--shiki-dark:#F8F8F2",[332],{"type":27,"value":333},"\u003C",{"type":22,"tag":105,"props":335,"children":336},{"style":112},[337],{"type":27,"value":17},{"type":22,"tag":105,"props":339,"children":341},{"style":340},"--shiki-default:#DFA000;--shiki-default-font-style:inherit;--shiki-dark:#50FA7B;--shiki-dark-font-style:italic",[342],{"type":27,"value":343}," culture",{"type":22,"tag":105,"props":345,"children":346},{"style":330},[347],{"type":27,"value":348},"=",{"type":22,"tag":105,"props":350,"children":352},{"style":351},"--shiki-default:#8DA101;--shiki-dark:#E9F284",[353],{"type":27,"value":354},"\"",{"type":22,"tag":105,"props":356,"children":358},{"style":357},"--shiki-default:#8DA101;--shiki-dark:#F1FA8C",[359],{"type":27,"value":360},"auto",{"type":22,"tag":105,"props":362,"children":363},{"style":351},[364],{"type":27,"value":354},{"type":22,"tag":105,"props":366,"children":367},{"style":340},[368],{"type":27,"value":369}," uiCulture",{"type":22,"tag":105,"props":371,"children":372},{"style":330},[373],{"type":27,"value":348},{"type":22,"tag":105,"props":375,"children":376},{"style":351},[377],{"type":27,"value":354},{"type":22,"tag":105,"props":379,"children":380},{"style":357},[381],{"type":27,"value":360},{"type":22,"tag":105,"props":383,"children":384},{"style":351},[385],{"type":27,"value":354},{"type":22,"tag":105,"props":387,"children":388},{"style":330},[389],{"type":27,"value":390}," />\n",{"type":22,"tag":23,"props":392,"children":393},{},[394],{"type":27,"value":395},"or at individual page level with:",{"type":22,"tag":94,"props":397,"children":399},{"className":96,"code":398,"language":98,"meta":99,"style":99},"\u003C@ Page ... Culture=\"auto\" UICulture=\"auto\">\n",[400],{"type":22,"tag":74,"props":401,"children":402},{"__ignoreMap":99},[403],{"type":22,"tag":105,"props":404,"children":405},{"class":107,"line":108},[406,410,415,420,425,430,434,438,442,446,451,455,459,463,467],{"type":22,"tag":105,"props":407,"children":408},{"style":112},[409],{"type":27,"value":333},{"type":22,"tag":105,"props":411,"children":412},{"style":130},[413],{"type":27,"value":414},"@ Page ",{"type":22,"tag":105,"props":416,"children":417},{"style":112},[418],{"type":27,"value":419},"..",{"type":22,"tag":105,"props":421,"children":422},{"style":130},[423],{"type":27,"value":424},". ",{"type":22,"tag":105,"props":426,"children":427},{"style":177},[428],{"type":27,"value":429},"Culture",{"type":22,"tag":105,"props":431,"children":432},{"style":112},[433],{"type":27,"value":348},{"type":22,"tag":105,"props":435,"children":436},{"style":351},[437],{"type":27,"value":354},{"type":22,"tag":105,"props":439,"children":440},{"style":357},[441],{"type":27,"value":360},{"type":22,"tag":105,"props":443,"children":444},{"style":351},[445],{"type":27,"value":354},{"type":22,"tag":105,"props":447,"children":448},{"style":130},[449],{"type":27,"value":450}," UICulture",{"type":22,"tag":105,"props":452,"children":453},{"style":112},[454],{"type":27,"value":348},{"type":22,"tag":105,"props":456,"children":457},{"style":351},[458],{"type":27,"value":354},{"type":22,"tag":105,"props":460,"children":461},{"style":357},[462],{"type":27,"value":360},{"type":22,"tag":105,"props":464,"children":465},{"style":351},[466],{"type":27,"value":354},{"type":22,"tag":105,"props":468,"children":469},{"style":112},[470],{"type":27,"value":471},">\n",{"type":22,"tag":62,"props":473,"children":475},{"id":474},"localize-the-classes",[476],{"type":27,"value":477},"Localize the classes",{"type":22,"tag":23,"props":479,"children":480},{},[481],{"type":27,"value":482},"For every bit of code that sets a string that will end up on the user’s display you now have to move that into the language resource file and replace the code with a reference to it. So if for example you had;",{"type":22,"tag":94,"props":484,"children":486},{"className":96,"code":485,"language":98,"meta":99,"style":99},"if (name.Length == 0) error.Text = \"Please enter a name\";\n",[487],{"type":22,"tag":74,"props":488,"children":489},{"__ignoreMap":99},[490],{"type":22,"tag":105,"props":491,"children":492},{"class":107,"line":108},[493,498,503,508,513,518,523,528,532,537,542,546],{"type":22,"tag":105,"props":494,"children":495},{"style":259},[496],{"type":27,"value":497},"if",{"type":22,"tag":105,"props":499,"children":500},{"style":130},[501],{"type":27,"value":502}," (name.",{"type":22,"tag":105,"props":504,"children":505},{"style":177},[506],{"type":27,"value":507},"Length",{"type":22,"tag":105,"props":509,"children":510},{"style":112},[511],{"type":27,"value":512}," ==",{"type":22,"tag":105,"props":514,"children":515},{"style":223},[516],{"type":27,"value":517}," 0",{"type":22,"tag":105,"props":519,"children":520},{"style":130},[521],{"type":27,"value":522},") error.",{"type":22,"tag":105,"props":524,"children":525},{"style":177},[526],{"type":27,"value":527},"Text",{"type":22,"tag":105,"props":529,"children":530},{"style":112},[531],{"type":27,"value":195},{"type":22,"tag":105,"props":533,"children":534},{"style":351},[535],{"type":27,"value":536}," \"",{"type":22,"tag":105,"props":538,"children":539},{"style":357},[540],{"type":27,"value":541},"Please enter a name",{"type":22,"tag":105,"props":543,"children":544},{"style":351},[545],{"type":27,"value":354},{"type":22,"tag":105,"props":547,"children":548},{"style":130},[549],{"type":27,"value":550},";\n",{"type":22,"tag":23,"props":552,"children":553},{},[554],{"type":27,"value":555},"Then you move “Please enter a name” into the resource file and give it a sensible key such as NameBlankError and modify the above line to read;",{"type":22,"tag":94,"props":557,"children":559},{"className":96,"code":558,"language":98,"meta":99,"style":99},"if (name.Length == 0) error.Text = Resources.Language.NameBlankError;\n",[560],{"type":22,"tag":74,"props":561,"children":562},{"__ignoreMap":99},[563],{"type":22,"tag":105,"props":564,"children":565},{"class":107,"line":108},[566,570,574,578,582,586,590,594,598,603,608,612,617],{"type":22,"tag":105,"props":567,"children":568},{"style":259},[569],{"type":27,"value":497},{"type":22,"tag":105,"props":571,"children":572},{"style":130},[573],{"type":27,"value":502},{"type":22,"tag":105,"props":575,"children":576},{"style":177},[577],{"type":27,"value":507},{"type":22,"tag":105,"props":579,"children":580},{"style":112},[581],{"type":27,"value":512},{"type":22,"tag":105,"props":583,"children":584},{"style":223},[585],{"type":27,"value":517},{"type":22,"tag":105,"props":587,"children":588},{"style":130},[589],{"type":27,"value":522},{"type":22,"tag":105,"props":591,"children":592},{"style":177},[593],{"type":27,"value":527},{"type":22,"tag":105,"props":595,"children":596},{"style":112},[597],{"type":27,"value":195},{"type":22,"tag":105,"props":599,"children":600},{"style":130},[601],{"type":27,"value":602}," Resources.",{"type":22,"tag":105,"props":604,"children":605},{"style":177},[606],{"type":27,"value":607},"Language",{"type":22,"tag":105,"props":609,"children":610},{"style":130},[611],{"type":27,"value":185},{"type":22,"tag":105,"props":613,"children":614},{"style":177},[615],{"type":27,"value":616},"NameBlankError",{"type":22,"tag":105,"props":618,"children":619},{"style":130},[620],{"type":27,"value":550},{"type":22,"tag":23,"props":622,"children":623},{},[624,626,635,637,643],{"type":27,"value":625},"There is a ",{"type":22,"tag":627,"props":628,"children":632},"a",{"href":629,"rel":630},"https://www.codeplex.com/Wiki/View.aspx?ProjectName=ResourceRefactoring",[631],"nofollow",[633],{"type":27,"value":634},"Resource Refactoring Tool",{"type":27,"value":636}," to do this for you now! Just right-click the string, choose ",{"type":22,"tag":638,"props":639,"children":640},"em",{},[641],{"type":27,"value":642},"Extract to resource",{"type":27,"value":644}," and fill in the blanks.",{"type":22,"tag":62,"props":646,"children":648},{"id":647},"localize-the-pages",[649],{"type":27,"value":650},"Localize the pages",{"type":22,"tag":23,"props":652,"children":653},{},[654],{"type":27,"value":655},"Unlike the WinForms designer the WebForms one doesn’t support multi-language so you’re instead forced to do it by hand. One way is to remove all the text from the page and place it into the resource language file.",{"type":22,"tag":23,"props":657,"children":658},{},[659],{"type":27,"value":660},"Then create a private void Localize() method in each page that simply looks something like;",{"type":22,"tag":94,"props":662,"children":664},{"className":96,"code":663,"language":98,"meta":99,"style":99},"public void Localize() {\n    Title = Resources.Language.LoginPageTitle;\n    loginButton.Text = Resources.Language.LoginPageLoginButton;\n    reminderButton.Text = Resources.Language.LoginPageReminderButton;\n}\n",[665],{"type":22,"tag":74,"props":666,"children":667},{"__ignoreMap":99},[668,689,722,759,796],{"type":22,"tag":105,"props":669,"children":670},{"class":107,"line":108},[671,675,679,684],{"type":22,"tag":105,"props":672,"children":673},{"style":112},[674],{"type":27,"value":115},{"type":22,"tag":105,"props":676,"children":677},{"style":118},[678],{"type":27,"value":121},{"type":22,"tag":105,"props":680,"children":681},{"style":124},[682],{"type":27,"value":683}," Localize",{"type":22,"tag":105,"props":685,"children":686},{"style":130},[687],{"type":27,"value":688},"() {\n",{"type":22,"tag":105,"props":690,"children":691},{"class":107,"line":168},[692,697,701,705,709,713,718],{"type":22,"tag":105,"props":693,"children":694},{"style":130},[695],{"type":27,"value":696},"    Title ",{"type":22,"tag":105,"props":698,"children":699},{"style":112},[700],{"type":27,"value":348},{"type":22,"tag":105,"props":702,"children":703},{"style":130},[704],{"type":27,"value":602},{"type":22,"tag":105,"props":706,"children":707},{"style":177},[708],{"type":27,"value":607},{"type":22,"tag":105,"props":710,"children":711},{"style":130},[712],{"type":27,"value":185},{"type":22,"tag":105,"props":714,"children":715},{"style":177},[716],{"type":27,"value":717},"LoginPageTitle",{"type":22,"tag":105,"props":719,"children":720},{"style":130},[721],{"type":27,"value":550},{"type":22,"tag":105,"props":723,"children":724},{"class":107,"line":234},[725,730,734,738,742,746,750,755],{"type":22,"tag":105,"props":726,"children":727},{"style":130},[728],{"type":27,"value":729},"    loginButton.",{"type":22,"tag":105,"props":731,"children":732},{"style":177},[733],{"type":27,"value":527},{"type":22,"tag":105,"props":735,"children":736},{"style":112},[737],{"type":27,"value":195},{"type":22,"tag":105,"props":739,"children":740},{"style":130},[741],{"type":27,"value":602},{"type":22,"tag":105,"props":743,"children":744},{"style":177},[745],{"type":27,"value":607},{"type":22,"tag":105,"props":747,"children":748},{"style":130},[749],{"type":27,"value":185},{"type":22,"tag":105,"props":751,"children":752},{"style":177},[753],{"type":27,"value":754},"LoginPageLoginButton",{"type":22,"tag":105,"props":756,"children":757},{"style":130},[758],{"type":27,"value":550},{"type":22,"tag":105,"props":760,"children":761},{"class":107,"line":290},[762,767,771,775,779,783,787,792],{"type":22,"tag":105,"props":763,"children":764},{"style":130},[765],{"type":27,"value":766},"    reminderButton.",{"type":22,"tag":105,"props":768,"children":769},{"style":177},[770],{"type":27,"value":527},{"type":22,"tag":105,"props":772,"children":773},{"style":112},[774],{"type":27,"value":195},{"type":22,"tag":105,"props":776,"children":777},{"style":130},[778],{"type":27,"value":602},{"type":22,"tag":105,"props":780,"children":781},{"style":177},[782],{"type":27,"value":607},{"type":22,"tag":105,"props":784,"children":785},{"style":130},[786],{"type":27,"value":185},{"type":22,"tag":105,"props":788,"children":789},{"style":177},[790],{"type":27,"value":791},"LoginPageReminderButton",{"type":22,"tag":105,"props":793,"children":794},{"style":130},[795],{"type":27,"value":550},{"type":22,"tag":105,"props":797,"children":799},{"class":107,"line":798},5,[800],{"type":22,"tag":105,"props":801,"children":802},{"style":130},[803],{"type":27,"value":296},{"type":22,"tag":23,"props":805,"children":806},{},[807],{"type":27,"value":808},"Obviously you need to call this from the page, I find that calling it from Page_PreRender works a treat.",{"type":22,"tag":23,"props":810,"children":811},{},[812,814,820],{"type":27,"value":813},"One disadvantage to this technique is your page itself ends up looking very blank in the designer or duplicates text that soon gets out of date. You could avoid this by leaving the default-language text in the page and not calling localize if you are running in that language. Be sure to put ",{"type":22,"tag":74,"props":815,"children":817},{"className":816},[],[818],{"type":27,"value":819},"“\\***”",{"type":27,"value":821}," or something in the default language resource file for it though so that if it’s missing for other languages you immediately spot the missing text during testing.",{"type":22,"tag":62,"props":823,"children":825},{"id":824},"dont-treat-types-as-strings",[826],{"type":27,"value":827},"Don’t treat types as strings",{"type":22,"tag":23,"props":829,"children":830},{},[831],{"type":27,"value":832},"If you have a number, treat it as a number and pass it around as a number. The same applies to dates etc.",{"type":22,"tag":23,"props":834,"children":835},{},[836],{"type":27,"value":837},"If you need to pass over to SQL etc. then use a parameterized query, they’re fast and will take care of all the regionalization stuff for you!",{"type":22,"tag":23,"props":839,"children":840},{},[841],{"type":27,"value":842},"To get those pesky strings in and out of the correct types see the following extra steps!",{"type":22,"tag":62,"props":844,"children":846},{"id":845},"always-use-tostring-to-format-output",[847],{"type":27,"value":848},"Always use .ToString() to format output",{"type":22,"tag":23,"props":850,"children":851},{},[852],{"type":27,"value":853},"Almost all basic .NET types include locale-aware formatting and so keep an eye on the ToString methods. Remember even numbers are formatted differently across the globe. 1,234.00 in England and the US becomes 1.234,00 in various parts of Europe.",{"type":22,"tag":23,"props":855,"children":856},{},[857],{"type":27,"value":858},"Be very careful of outputting currencies. .NET won’t convert the amount for you but you could easily find yourself with the wrong currency symbol and therefore a totally different price!",{"type":22,"tag":62,"props":860,"children":862},{"id":861},"always-use-tryparse-to-read-input",[863],{"type":27,"value":864},"Always use .TryParse to read input",{"type":22,"tag":23,"props":866,"children":867},{},[868],{"type":27,"value":869},"When accepting information from users hand over that string to TryParse for it to try and work out what’s going on. It will helpfully return a boolean indicating if it did the job okay; if not time to use that localized error-message.",{"type":22,"tag":23,"props":871,"children":872},{},[873],{"type":27,"value":874},"Auf wiedersehen!",{"type":22,"tag":23,"props":876,"children":877},{},[878],{"type":22,"tag":638,"props":879,"children":880},{},[881],{"type":27,"value":882},"[)amien",{"type":22,"tag":884,"props":885,"children":886},"style",{},[887],{"type":27,"value":888},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":99,"searchDepth":168,"depth":168,"links":890},[891,892,893,894,895,896,897,898],{"id":64,"depth":168,"text":67},{"id":84,"depth":168,"text":87},{"id":299,"depth":168,"text":302},{"id":474,"depth":168,"text":477},{"id":647,"depth":168,"text":650},{"id":824,"depth":168,"text":827},{"id":845,"depth":168,"text":848},{"id":861,"depth":168,"text":864},"markdown","content:blog:2006:globalising-net-web-applications.md","content","blog/2006/globalising-net-web-applications.md","blog/2006/globalising-net-web-applications","md","/blog/2006/globalising-net-web-applications/",766,[908,912,916],{"title":909,"date":910,"url":911},"HTML5 Video Cheatsheet: Optimizing videos for the web","2025-12-05T00:00:00Z","/blog/2025/html5-video-cheatsheet/",{"title":913,"date":914,"url":915},"Transactions in the MongoDB EF Core Provider","2025-10-25","/blog/2025/mongodb-explicit-transactions/",{"title":917,"date":918,"url":919},"Queryable Encryption with the MongoDB EF Core Provider","2025-09-22","/blog/2025/mongodb-queryable-encryption/",[921,943,961],{"_path":922,"_dir":923,"_draft":6,"_partial":6,"_locale":7,"title":924,"description":925,"id":926,"name":927,"email":928,"avatar":929,"url":930,"date":931,"body":932,"_type":899,"_id":940,"_source":901,"_file":941,"_stem":942,"_extension":904},"/comments/globalising-net-web-applications/1677","globalising-net-web-applications","1677","Ah, cool new tip Sander, I'll add that in!",1677,"Damien Guard","damien@envytech.co.uk","https://www.gravatar.com/avatar/dc72963e7279d34c85ed4c0b731ce5a9?r=pg&d=retro","https://damieng.com/","2006-11-05T12:31:07",{"type":19,"children":933,"toc":938},[934],{"type":22,"tag":23,"props":935,"children":936},{},[937],{"type":27,"value":925},{"title":99,"searchDepth":168,"depth":168,"links":939},[],"content:comments:globalising-net-web-applications:1677.md","comments/globalising-net-web-applications/1677.md","comments/globalising-net-web-applications/1677",{"_path":944,"_dir":923,"_draft":6,"_partial":6,"_locale":7,"title":945,"description":946,"id":947,"name":948,"date":949,"body":950,"_type":899,"_id":958,"_source":901,"_file":959,"_stem":960,"_extension":904},"/comments/globalising-net-web-applications/1676","1676","+1 Informative. Thanks!",1676,"Rik Hemsley","2006-11-05T12:07:46",{"type":19,"children":951,"toc":956},[952],{"type":22,"tag":23,"props":953,"children":954},{},[955],{"type":27,"value":946},{"title":99,"searchDepth":168,"depth":168,"links":957},[],"content:comments:globalising-net-web-applications:1676.md","comments/globalising-net-web-applications/1676.md","comments/globalising-net-web-applications/1676",{"_path":962,"_dir":923,"_draft":6,"_partial":6,"_locale":7,"title":963,"description":964,"id":965,"name":966,"date":967,"body":968,"_type":899,"_id":1054,"_source":901,"_file":1055,"_stem":1056,"_extension":904},"/comments/globalising-net-web-applications/1675","1675","In .NET 2.0 you can also use the",1675,"Sander Rijken","2006-11-05T10:57:10",{"type":19,"children":969,"toc":1052},[970,974,1036,1048],{"type":22,"tag":23,"props":971,"children":972},{},[973],{"type":27,"value":964},{"type":22,"tag":94,"props":975,"children":977},{"className":318,"code":976,"language":320,"meta":99,"style":99},"\u003Cglobalization culture=\"auto\" uiCulture=\"auto\">\n",[978],{"type":22,"tag":74,"props":979,"children":980},{"__ignoreMap":99},[981],{"type":22,"tag":105,"props":982,"children":983},{"class":107,"line":108},[984,988,992,996,1000,1004,1008,1012,1016,1020,1024,1028,1032],{"type":22,"tag":105,"props":985,"children":986},{"style":330},[987],{"type":27,"value":333},{"type":22,"tag":105,"props":989,"children":990},{"style":112},[991],{"type":27,"value":17},{"type":22,"tag":105,"props":993,"children":994},{"style":340},[995],{"type":27,"value":343},{"type":22,"tag":105,"props":997,"children":998},{"style":330},[999],{"type":27,"value":348},{"type":22,"tag":105,"props":1001,"children":1002},{"style":351},[1003],{"type":27,"value":354},{"type":22,"tag":105,"props":1005,"children":1006},{"style":357},[1007],{"type":27,"value":360},{"type":22,"tag":105,"props":1009,"children":1010},{"style":351},[1011],{"type":27,"value":354},{"type":22,"tag":105,"props":1013,"children":1014},{"style":340},[1015],{"type":27,"value":369},{"type":22,"tag":105,"props":1017,"children":1018},{"style":330},[1019],{"type":27,"value":348},{"type":22,"tag":105,"props":1021,"children":1022},{"style":351},[1023],{"type":27,"value":354},{"type":22,"tag":105,"props":1025,"children":1026},{"style":357},[1027],{"type":27,"value":360},{"type":22,"tag":105,"props":1029,"children":1030},{"style":351},[1031],{"type":27,"value":354},{"type":22,"tag":105,"props":1033,"children":1034},{"style":330},[1035],{"type":27,"value":471},{"type":22,"tag":23,"props":1037,"children":1038},{},[1039,1041,1046],{"type":27,"value":1040},"tag in the ",{"type":22,"tag":74,"props":1042,"children":1044},{"className":1043},[],[1045],{"type":27,"value":313},{"type":27,"value":1047}," tag of your web.config. That automatically sets the right culture and uiCulture, and avoids the Global.asax trick.",{"type":22,"tag":884,"props":1049,"children":1050},{},[1051],{"type":27,"value":888},{"title":99,"searchDepth":168,"depth":168,"links":1053},[],"content:comments:globalising-net-web-applications:1675.md","comments/globalising-net-web-applications/1675.md","comments/globalising-net-web-applications/1675",1779264594397]