2011 - DotNetFranken: ASP.NET MVC Localization
-
Upload
daniel-fisher -
Category
Software
-
view
51 -
download
0
Transcript of 2011 - DotNetFranken: ASP.NET MVC Localization
devcoach.com
ASP.NET MVC Localization
Daniel Fisher | devcoach
Καλώς Ήλθατε
Willkommen
Welcome
přivítat
bienvenido
bienvenu
sevilen
devcoach.com
devcoach.comBERTAUNG + SCHULUNG + PROJEKTE
• Themen– Architektur & Technologie
Evaluierung, Performance Optimierung, Entwicklungs-Unterstützung, Security Reviews, QA, POC & Know-how-Transfer
• Technologien– Services: WCF & WF– Data: ADO.NET & EF– Web: ASP.NET, MVC & Silverlight
• Kunden– Versicherung, Finanzindustrie,
Mittelstand, Handel, Kommunikation, Softwarehersteller… Und sie?
• Kontakt– [email protected]
devcoach.com
Daniel Fisher• devcoach.com
– Mit-Gründer und Geschäftsführer
• Justcommunity.de– Mit-Gründer und Vorstand
• nrwconf.de– Mit-Gründer und Organisator
• netug-niederrhein.de– Mit-Gründer und Leiter
• microsoft.com– Community Leader & Insider (CLIP)– Certified Professional Developer– Business Platform Technology Advisor
• lennybacon.com– Blog
• twitter.com– @lennybacon
devcoach.com
Agenda
• Loco?lize• Server– Thread Localization– Resource Localization– View Localization
• Client– Jquery Localization
• Summary
devcoach.com
Customer
• "Users should select a language (by clicking e.g. a flag) and information will be presented in the corresponding language."
devcoach.com
Developer
• "If the users clicks on a flag I reload the page and transmit the language as parameter to load the information in the corresponding language."
devcoach.com
The process of localization…
Server
HTTP GET
HTTP 200
HTTP GET (select language)
HTTP 200
HTTP GET
HTTP 200
devcoach.com
Customer
• "Users should select a language (by clicking e.g. a flag) and information will be presented in the corresponding language. The selection should be maintained as long as the user browses out site!"
devcoach.com
The process of localization…
Server
HTTP GET
HTTP 200
HTTP GET (select language)
HTTP 200
HTTP GET
HTTP 200
STATE
devcoach.com
Code
var language = Session["Language"] ?? Request.QueryString["lang"];
if(!string.IsNullOrWhitespace(language ){ Session["Language"] = language ;}
devcoach.com
Requirements
• Customer: Information should be presented in the language requested if possible.
devcoach.com
Wait… that is part of HTTP
• RFC2295: Transparent Content Negotiation in HTTP– http://gewis.win.tue.nl/~koen/conneg/rfc
2295.txt
devcoach.com
Resource Localization
• The ASP.NET Web Forms Way– [Page/
Control].GetGlobalResourceObject(…)– [Page/
Control].GetLocalResourceObject(…)–<asp:Button ID="btnSubmit"
runat="server" Text="<%$ Resources:btnSubmit.Text %>" />
–<asp:Button ID="btnSubmit" runat="server" meta:resourcekey="btnSubmit" />
devcoach.com
Resource Localization Tools
• Zeta Resource Editor?
• Kein ASP.NET? WPF?– NLocalize ;-)• http://www.nlocalize.de• Auch hier Sponsor!
devcoach.comResource Localization
Extensibility
ASP.NET
ResourceProviderFactory
ResourceProvider
ResourceReader
Your Code