Internationalization in the Java Stack Matt Wheeler.

Slides:



Advertisements
Similar presentations
9 Copyright © 2005, Oracle. All rights reserved. Modularizing JavaServer Pages Development with Tags.
Advertisements

JSP and web applications
Apache Struts Technology
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
1 Introduction to XML. XML eXtensible implies that users define tag content Markup implies it is a coded document Language implies it is a metalanguage.
COMP205 Comparative Programming Languages Part 1: Introduction to programming languages Lecture 3: Managing and reducing complexity, program processing.
Internationalization of Java Platform Presenter: Ataru Nakazawa Advisor: Xiaoping Jia Date: January 23, 2004.
Apache Struts Technology A MVC Framework for Java Web Applications.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Internationalization and the Java Stack Part 2 Matt Wheeler.
LDS Account and the Java Stack. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in labs Please ask questions.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Struts 2.0 an Overview ( )
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
San José, CA – September, 2004 Localizing with XLIFF and ICU Markus Scherer Raghuram (Ram) Viswanadha IBM San.
JSP Standard Tag Library
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
AITI Tutorial: Internationalization Coding for the world MIT AITI July NNth, 2005.
Java Programming: Advanced Topics 1 Collections and Wealth of Utilities.
Sakai: Localization & Internationalization Beth Kirschner University of Michigan
Internationalization and the Java Stack Part 1 Matt Wheeler.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Internationalization and the Java Stack Matt Wheeler.
Introduction to Java Server Pages (JSPs) Robert Thornton.
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
Company Confidential 1 This presentation is solely for the use of Patni personnel. No part of it may be circulated, quoted, or reproduced for distribution.
Internationalization in the Java Stack Matt Wheeler.
Introduction to Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Chapter 14 Internationalization F Processing Date and Time –Locale –Date –TimeZone –Calendar and GregorianCalendar –DateFormat and SimpleDateFormat F Formatting.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 26 Internationalization.
JSTL Lec Umair©2006, All rights reserved JSTL (ni) Acronym of  JavaServer Pages Standard Tag Library JSTL (like JSP) is a specification, not an.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Forms with Spring MVC Handling Form.
WAM and the Java Stack. Disclaimer Please ask questions There are hands on labs Prerequisites: – Basic Java knowledge – Basic Spring knowledge – LDS Account.
Copenhagen, 6 June 2006 EC CHM Multilinguality Anton Cupcea Finsiel Romania.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Views Rendering custom views.
Intermediate Spring Matt Wheeler. Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
Design of an Integrated Robot Simulator for Learning Applications Brendon Wilson April 15th, 1999.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
WebObjects Matt Aguirre Lally Singh. What Is It? A Java based development platform specifically designed for database-backed web applications.
JAVA BEANS JSP - Standard Tag Library (JSTL) JAVA Enterprise Edition.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
1 Chapter 20 Internationalization. 2 Objectives F To describe Java's internationalization features (§ 20.1). F To construct a locale with language, country,
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Overview of the Spring Framework Introducing.
10 Copyright © 2004, Oracle. All rights reserved. Building ADF View Components.
1.
Internationalization and the Java Stack Part 2 Matt Wheeler.
Chapter 2 Java Struct 2. Content Basic MVC Architecture Struts 2 Overview Struts 2 - Architecture.
Apache Struts Technology A MVC Framework for Java Web Applications.
CHAPTER 9 File Storage Shared Preferences SQLite.
WAM and the Java Stack. Disclaimer This is a training NOT a presentation. – Be prepared to learn and participate in labs Please ask questions Prerequisites:
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
A Presentation Presentation On JSP On JSP & Online Shopping Cart Online Shopping Cart.
CS520 Web Programming Spring – Web MVC Chengyu Sun California State University, Los Angeles.
Struts 2 Development. Topics  Roles in Struts Development  Control Flow  Actions  Struts 2 Views and Target  Struts 2 Custom Tags  Validation 
Metropolia 2013 C# programming and .NET framework
Internationalization
SAP Hybris Online Training SAP Hybris Online Training
#01 Client/Server Computing
EPIC INFOTECH CONSULTING GROUP
Chapter 35 Internationalization
#01 Client/Server Computing
Dependency Injection Mechanism
Presentation transcript:

Internationalization in the Java Stack Matt Wheeler

Notes This is a training NOT a presentation Please ask questions Prerequisites – Introduction to Java Stack – Basic Java and XML skills – Installed LdsTech IDE (or other equivalent – good luck there ;)

Overview Internationalization in general Java Internationalization (ResourceBundle) Spring Internationalization (MessageSource) MessageSource vs. ResourceBundle Spring Helpers JSP tags Locale change interceptor Locale resolver

Internationalization in General (I18n) "Internationalization, in relation to computer programming, is the process of designing and writing an application so that it can be used in a global or multinational context. An internationalized program is capable of supporting different languages, as well as date, time, currency, and other values, without software modification.“

Internationalization (continued) "Internationalization is the process of designing software so that it can be adapted (localized) to various languages and regions easily, cost- effectively, and in particular without engineering changes to the software. This generally involves isolating the parts of a program that are dependent on language and culture....“ – j-i18n/section2.html

Localization (L10n) "Localization is the process of adapting a program for use in a specific locale. A locale is a geographic or political region that shares the same language and customs. Localization includes the translation of text such as user interface labels, error messages, and online help. It also includes the culture-specific formatting of data items such as monetary values, times, dates, and numbers."

Localization (continued) "Localization is the process of designing and writing an application capable of dealing with a specific regional, country, language, cultural, business, or political context. In a sense, every application written for a specific area is localized, although most of these effectively support only one locale. Usually, though, true localization is achieved by core code that accesses locale, location, political, or other specific components and modules, along with translating text as appropriate for the audience. A properly internationalized program facilitates and provides a foundation for localization.“ – i18n/section2.html

First Steps of Internationalization Extract translatable text from code Load resources for a specific locale Inject locale specific resources into the application

Java Internationalization (ResourceBundle) ResourceBundle is the basis of Java internationalization – Backed by different data stores Property files (PropertyResourceBundle) Java source code (ListResourceBundle) Represents a collection of key/value pairs for a given locale

For example Property file(s) Accessing the resource ResourceBundle.getBundle("bundle").getString("abc") //some string ResourceBundle.getBundle("bundle", Locale.ITALIAN).getString("abc") //some Italian string #bundle.properties abc=some string #bundle_it.properties abc=some Italian string

DEMO

Spring Internationalization (MessageSource) MessageSource is the root of Spring internationalization MessageSource interface – An abstraction to the actual text store of translated resources Data store can be properties files, database, MarkLogic, … Implement the interface for the given resource store – Implementation of MessageSource can use resource bundles as in native Java

MessageSource Example Place resource bundles in src/main/bundles Configure the message source as follows: classpath:messages classpath:otherbundle

Inject MessageSource Utilize the private MessageSource method=RequestMethod.GET) public void getAStringInCode(ModelMap model) { String message = messageSource.getMessage("abc", null, "default", Locale.US); //do something with message return; }

MessageSource vs. ResourceBundle MessageSource allows all resources to be conglomerated together MessageSource does parameter replacement automatically MessageSource allows for a default (in case message is not found) #born={0} was born on {1}. String pattern = ResourceBundle.getBundle("whatever", Locale.ENGLISH).getString("born"); MessageFormat.format(pattern, "Billy", new Date()) messageSource.getMessage("born", new Object[] {"Billy“, new Date()}, "default", Locale.ENGLISH)

Spring MessageSource taglib ng-framework- reference/html/spring.tld.html#spring.tld.message

DEMO

Spring Internationalization Architecture LocaleResolver – Attempts to determine the current user’s locale – Provides a way to set / cache current user’s locale LocaleChangeInterceptor – Picks up locale changes (from request parameter by default) – Sets locale on the resolver

ChainedLocaleResolver Based on Spring LocaleResolver interface Locale resolution on steroids Sets up multiple locale resolvers from which to determine the user’s locale

ChainedLocaleResolver (configuration) Basic configuration Or when using WAM code.lds.org/maven- sites/stack/module.html?module=web- spring/xsddoc/index.html code.lds.org/maven- sites/stack/module.html?module=web- spring/apidocs/org/lds/stack/web/spring/i18n/ChainedLo caleResolver.html xmlns:stack-web="

Spring MessageSource taglib

Lab 1: Internationalize a page ab_2_Dependency_Injection

Credit where credit is due ials/j-i18n/section2.html