Internationalization Andres Käver, IT Kolledž 2015.

Slides:



Advertisements
Similar presentations
JSP and Servelets.
Advertisements

Chapter 61 Processing the Client Request JavaServer Pages By Xue Bai.
XP Tutorial 9 New Perspectives on JavaScript, Comprehensive1 Working with Cookies Managing Data in a Web Site Using JavaScript Cookies.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
JSP Architecture  JSP is a simple text file consisting of HTML or XML content along with JSP elements  JSP packages define the interface for the compiled.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Project Implementation for COSC 5050 Distributed Database Applications Lab5.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
ASHIMA KALRA.  INTRODUCTION TO JSP INTRODUCTION TO JSP  IMPLICIT OBJECTS IMPLICIT OBJECTS  COOKIES COOKIES.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Unit 7 – Working with Forms 1. Creating a form 2. Accessing the submitted data 3. Common operations on forms.
Global web applications1 Adapting ASP.NET web applications to work in different cultures.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
CSC 2720 Building Web Applications Cookies, URL-Rewriting, Hidden Fields and Session Management.
Internationalization and the Java Stack Part 1 Matt Wheeler.
IT533 Lectures Session Management in ASP.NET. Session Tracking 2 Personalization Personalization makes it possible for e-businesses to communicate effectively.
WEB326 ASP.NET 2.0: Going Global Gets Easier! New Localization Features in ASP.NET 2.0 Michele Leroux Bustamante Architect, IDesign Microsoft Regional.
Internationalization and the Java Stack Matt Wheeler.
Session and cookie management in.Net Justin Brunelle CS795 6/18/2009.
The Company….  The Market Leader in Globalization Technology –Pioneers in visual translation environments –Solutions for major platforms & programming.
State Management. What is State management Why State management ViewState QueryString Cookies.
Chapter 7 Java Server Pages. Objectives Explain how the separation of concerns principle applies to JSP Describe the operation and life-cycle of a JSP.
Introduction to ASP.NET MVC Information for this presentation was taken from Pluralsight Building Applications with ASP.NET MVC 4.
Internationalization in the Java Stack Matt Wheeler.
® IBM Software Group © 2007 IBM Corporation JSP Expression Language
Tracing 1www.tech.findforinfo.com. Contents Why Tracing Why Tracing Tracing in ASP.NET Tracing in ASP.NET Page Level tracing Page Level tracing Application.
Globalization Support in Microsoft.NET Framework François Liger Program Manager Microsoft Corporation.
Maintaining State MacDonald Ch. 9 MIS 324 MIS 324 Professor Sandvig Professor Sandvig.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 26 Internationalization.
10 – 12 APRIL 2005 Riyadh, Saudi Arabia. Building multi-lingual ASP.Net application that handle western languages and Arabic with a single code base.
DEV382 Building International Applications with the.NET Framework Christian Nagel Microsoft Regional Director Global Knowledge.
Caching Chapter 12. Caching For high-performance apps Caching: storing frequently-used items in memory –Accessed more quickly Cached Web Form bypasses:
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Session and Cookie Management in.Net Sandeep Kiran Shiva UIN:
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
Anatomy of an ASP.NET Page. Slide 2 Compiling an ASP.NET Page An ASP.NET page is compiled when it is rendered for the first time A page is compiled to.
Topics Sending an Multipart message Storing images Getting confirmation Session tracking using PHP Graphics Input Validators Cookies.
Internationalization in ASP.NET 2.0. SQL Server 2005 – Data Columns Use Unicode datatypes in: Table columns, CONVERT() and CAST() operations Use Unicode.
ASP.Net, Web Forms and Web Controls 1 Outline Session Tracking Cookies Session Tracking with HttpSessionState.
® IBM Software Group © 2006 IBM Corporation Using JSF Mini-Calendar Controls This section describes how to use a JSF Mini-Calendar Control with EGL It.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
1 Web Programming with Servlets & JSP ASSIGNMENT GUIDELINE.
What’s new in ASP.NET 4.0 ?. Agenda Changes to Core Services  Extensible Output Caching  Shrinking Session State  Performance Monitoring  Permanently.
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
DEV392.NET Framework: Building Applications With Globalization In Mind Michele Leroux Bustamante Principal Software Architect IDesign Inc.
1 Chapter 20 Internationalization. 2 Objectives F To describe Java's internationalization features (§ 20.1). F To construct a locale with language, country,
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
Bundles, Minification Andres Käver, IT Kolledž
Session, TempData, Cache Andres Käver, IT Kolledž
Using the Kentico CMS API Thom Robbins Bryan Soltis
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC -
I18n - DateTime ASP.NET MVC. I18n DateTime – EF changes  In model classes, use attributes  DataType(DataType.DateTime)  DataType(DataType.Date)  DataType(DataType.Time)
National College of Science & Information Technology.
Building Web Applications with Microsoft ASP
3 Introduction to Classes and Objects.
Session Variables and Post Back
Globalization support in ASP.NET
MIS Professor Sandvig MIS 324 Professor Sandvig
Play Framework: Introduction
ASP.NET Razor Engine SoftUni Team ASP.NET MVC Introduction
Building Web Applications with Microsoft ASP
PHP / MySQL Introduction
MIS Professor Sandvig MIS 324 Professor Sandvig
Anatomy of an ASP.NET Page
Social Media And Global Computing Managing MVC with Custom Models
© 2016, Mike Murach & Associates, Inc.
Presentation transcript:

Internationalization Andres Käver, IT Kolledž 2015

Internationalization  Globalization (G11N): The process of making an application support different languages and regions.  Localization (L10N): The process of customizing an application for a given language and region.  Internationalization (I18N): Describes both globalization and localization.  Culture: It is a language and, optionally, a region.  Locale: A locale is the same as a culture.  Neutral culture: A culture that has a specified language, but not a region. (e.g. "en", "es")  Specific culture: A culture that has a specified language and region. (e.g. "en-US", "en-GB", "es-CL")  us/goglobal/bb aspx 2

Example 3 int value = 5600; Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-CL"); Console.WriteLine(DateTime.Now.ToShortDateString()); Console.WriteLine(value.ToString("c")); Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-MX"); Console.WriteLine(DateTime.Now.ToShortDateString()); Console.WriteLine(value.ToString("c")); // Output // Date in es-CL, Spanish (Chile) $5.600,00 // Currency in es-CL, Spanish (Chile) 26/07/2011 // Date in es-MX, Spanish (Mexico) $5, // Currency in es-MX, Spanish (Mexico)

Resources  Add new class library to solution, named Resources  Add new item to project: Resources files  Default culture en-US Resources.resx  Typically use only language part in extension Resources.et.resx (et-EE) 4

Resources 5

6

Validation/Laber/editor messages 7 [Required(ErrorMessageResourceName = "FirstNameRequired", ErrorMessageResourceType = typeof(Resources.Resources))] [MaxLength(5, ErrorMessageResourceName = "FirstNameTooLong", ErrorMessageResourceType = typeof(Resources.Resources))] [MinLength(2, ErrorMessageResourceName = "FirstNameTooShort", ErrorMessageResourceType = typeof(Resources.Resources))] [Display(Name = "FirstName", ResourceType = typeof(Resources.Resources))] public String FirstName { get; set; }

Views catalog, web.config 8

Razor  Html helpers – from attributes  Static text in 9

Language determination  header field Accept-Language on every request Accept-Language: en-us,en;q=0.5 en-us – preffered en – next choice q=0.5 – estimate of users prefernce for that language 10

System language  ASP.NET (System.Web) keeps track in each thread:  Culture determines the results of culture-dependent functions, such as the date, number, and currency formatting, and so on  UICulture determines which resources are loaded for the page 11

Language override  Implement controller/action for user language choice selection – cookie creation  Keep track of users choice (cookie, session)  On every request, inspect users choice, update threads culture info  Implement base controller for cookie inspection 12

Base controller 13 public class BaseController : Controller { protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state) { string cultureName = null ; // Attempt to read the culture cookie from Request HttpCookie cultureCookie = Request.Cookies["_culture"]; if (cultureCookie != null ) cultureName = cultureCookie.Value; else cultureName = Request.UserLanguages != null && Request.UserLanguages.Length > 0 ? Request.UserLanguages[0] : // obtain it from HTTP header AcceptLanguages null ; // Validate culture name cultureName = CultureHelper.GetImplementedCulture(cultureName); // Modify current thread's cultures Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureName); Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; return base.BeginExecuteCore(callback, state); }

Controller action for language choice 14 public ActionResult SetCulture( string culture) { // Validate input culture = CultureHelper.GetImplementedCulture(culture); // Save culture in a cookie HttpCookie cookie = Request.Cookies["_culture"]; if (cookie != null ) cookie.Value = culture; // update cookie value else { cookie = new HttpCookie("_culture"); cookie.Value = culture; cookie.Expires = DateTime.Now.AddYears(1); } Response.Cookies.Add(cookie); return RedirectToAction("Index"); }