localizing j2ee web applications tony jewtushenko principal product manager lrc localisation summer...
TRANSCRIPT
![Page 1: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/1.jpg)
![Page 2: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/2.jpg)
Localizing J2EE Web Applications
Tony Jewtushenko
Principal Product Manager
LRC Localisation Summer School, June 2004
![Page 3: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/3.jpg)
Internationalization
“Internationalization is the process of generalizing a product so that it can handle multiple languages and cultural conventions without the need for redesign. Internationalization takes place at the level of program design and document development.” 1
AKA: Internationalisation – UK Spelling and i18n.
1 LISA: Localisation Industry Standards Assoc.
![Page 4: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/4.jpg)
Localization
“Localization involves taking a product and making it linguistically and culturally appropriate to the target locale (country/region and language) where it will be used and sold.” 1
AKA: Localisation - the UK English spelling and L10n - the techie contraction
1 LISA: Localisation Industry Standards Assoc.
![Page 5: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/5.jpg)
Multilingual Application Basic Concepts
Data representation: charter set support Data manipulation: collation, direction of text
and internal representation Data display: display strings, currency,
number, date formats weights and measures Data input: understand the format of the data
submitted to the application
![Page 6: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/6.jpg)
Stages of a Multilingual Development Process
Internationalization Localization
– Identify / isolate / extract– Translation– Re-use Translations (optional)
![Page 7: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/7.jpg)
What’s Localized in Web Applications:
Titles Button Text (UIX) Button Graphics / Text (JSP) Links Labels HTML and XML Markup Error and validation messages Database Row or Column names Hint (balloon) text Help
Date Formats Date Pickers Numeric Formats
– Currency– Numbers– Percents
Message Formatting
![Page 8: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/8.jpg)
J2EE: “Java 2 Platform Enterprise Edition”
Sun’s Java-centric platform independent environment for developing, building and deploying Web-based enterprise applications.EJB, JSP, JAX-RPC, Java Servlets, J2EE Connector Architecture, J2EE Management Model, J2EE Deployment API, JMX, J2EE Authorization Contract for Containers, JAXR, JMS, JNDI, JTA, CORBA, and JDBC data access API.
![Page 9: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/9.jpg)
J2EE: Key Benefits
Rapid development Support for Web services Standardized connectivity to existing data
sources and applications Platform independence – no “vendor lock-in”
![Page 10: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/10.jpg)
MVC Design Pattern
MVC = Model / View / Controller– Model components maintain backend
data– View provides end user presentation
layer– Controller provides page flow logic,
and validation
![Page 11: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/11.jpg)
MVC Web Application Architecture
Web Browser
UIController Model
View
DB or
Remote
System
1
45
32
![Page 12: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/12.jpg)
Jakarta Struts
Created in 2000 Current version = 1.1 Open source J2EE applications development
framework Primarily based on JSP and Servlet technology. Subproject of Apache Jakarta Supports MVC Model 2 architecture
– View and Controller are separated– Cleanly separates page design from underlying Java
code
![Page 13: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/13.jpg)
Oracle J2EE Application Development Framework (ADF)
Swing ADF UIX JSF
Struts
ADF Model
WebServices
EJBSession
Beans
ADFBusiness
Components
JavaBeans/Other
View Swing JSPJSP ADF UIX
Controller
Model
BusinessServices
Rich Client Web Client
![Page 14: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/14.jpg)
Exercise 1Create a Basic JSP
Page
![Page 15: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/15.jpg)
Exercise 2Create a Basic UIX
Page
![Page 16: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/16.jpg)
Challenges in J2EE i18n
Encoding – Locale specific character set support
Messaging – Isolation and Translation of UI resources such as text
Formatting – Handling input and output of locale conventions for formatting of numbers, dates, currency
![Page 17: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/17.jpg)
Encoding in J2EE
JSP is Java, so Unicode is used internally, but… 3 types of encoding must be considered for JSP’s
Request: – Encoding in which parameters in an incoming request are
interpreted.
Page (JSP pages)– the encoding of the bytes in the JSP page itself. If not set,
encoding defaults to contentType charset attribute setting.
Response– encoding to be used for generated web pages, based on the
capabilities of the targeted browsers.
![Page 18: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/18.jpg)
Request Encoding
Parameters submitted as byte values, in the specified charset
Set automatically to Accept-Language header using:
<fmt:requestEncoding/> or first i18n action
Or set explicitly with<fmt:requestEncoding value=“UTF-8”/>
![Page 19: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/19.jpg)
Page Encoding
Usually determined by editing tools conventions Set in page directive
<%@ page pageEncoding=“Shift_JIS” contentType=“text/html;charset=UTF-8” %>
– Must be extension of ASCII charset (ie, no EBCDIC or UTF-16) so UTF-8 is OK
– If not explicitly set, defaults to contentType charset attribute value, but recommended to explicitly set
![Page 20: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/20.jpg)
Response Encoding
Identifies the encoding of the generated web page Set in contentType attribute
<%@ page pageEncoding=“Shift_JIS” contentType=“text/html;charset=UTF-8” %>
![Page 21: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/21.jpg)
Exercise 3
Encoding
![Page 22: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/22.jpg)
Java ResourceBundles: Localizable content
ListResourceBundle– .java file– Can contain binary data– Compiled into class file
PropertyResourceBundles– .properties file– Contain strings only– Values acquired at runtime– Requires 8859-1 encoding– Non 8859-1 characters represented as
UTF8 escape codes (ie, \uxxxx)– native2ascii to convert non 8859-1
content
![Page 23: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/23.jpg)
ResourceBundle Search Algorithm (baseclass)+(specific language)+(specific country)+(specific variant)
(baseclass)+(specific language)+(specific country)
(baseclass)+(specific language) (baseclass)+(default language)+(default country)+(default variant)
(baseclass)+(default language)+(default country)
(baseclass)+(default language)
![Page 24: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/24.jpg)
ResourceBundle and Locale
greeting-evening=Hello
ApplicationResources
fr_CA_UNIX
greeting-evening= Bonsoir
ApplicationResources_fr
greeting-evening=Good Evening
ApplicationResources_en_GB
JSP
ResourceBundle
![Page 25: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/25.jpg)
Oracle ADF ResourceBundle Implementation
ListResourceBundle– Model entity properties such as Column names,
Hint Text, custom messages– Validation Errors
PropertyResourceBundle– All text, titles, etc.– E.g., button text, headers, titles, error
messages– Slightly slower performance than
ListResourceBundle
![Page 26: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/26.jpg)
Localizing ListResourceBundles
1. Subclass the base java ResourceBundle2. Append the constructor with language
suffixe.g., public MyMsgBundle_es()
3. Translate all strings, modify format masks, etc
4. Recompile, explicitly specifying character encoding if other than ISO8859-1
![Page 27: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/27.jpg)
package model.common;import oracle.jbo.common.JboResourceBundle;// ---------------------------------------------------------------// --- File generated by Oracle Business Components for Java.// ---------------------------------------------------------------public class PmViewRowImplMsgBundle_es extends PmViewRowImplMsgBundle{ /** */ public PmViewRowImplMsgBundle_es() { } /** * * @return an array of key-value pairs. */ public Object[][] getContents() { return super.getMergedArray(sMessageStrings, super.getContents()); }
static final Object[][] sMessageStrings = { {"PmId_LABEL", "Número de identificación"}, {"Email_LABEL", "Dirección del Correo Electrónico"}, {"Phone_LABEL", "Número De Teléfono"}, {"Jobtitle_LABEL", "Título Del Trabajo"}, {"Pmname_LABEL", "Nombre del P.M."}};}
A Translated ListResourceBundle
![Page 28: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/28.jpg)
Translating PropertiesResourceBundles:
Create language / locale specific properties files in the same location as base properties file
– E.g., create:
ApplicationsResources_es.properties– in same directory as base file:
ApplicationsResources.properties• Add keys and translated values • Any keys not found in language/locale subclass
will inherit values from the base class values
![Page 29: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/29.jpg)
Exercise 4
Creating and Localizing a ListResourceBundle
![Page 30: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/30.jpg)
PropertiesResourceBundles and Character Sets:
Properties files may only contain characters in the ISO 8859-1 character set.
Important: all non-8859-1 character sets must be converted to escaped UTF-8 characters, or they will appear corrupt in the browser!1. After translating text files, save to native properties file
(text file)
2. Convert to Unicode Escaped characters (i.e., € = \u20ac) by using the “native2ascii” utility in the JDK (ie, native2ascii –encoding UTF8 Errors_ja.properties
Errors_ja_88591.properties)
![Page 31: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/31.jpg)
errorpage.title=Página Del Errorerrorpage.apperror=Error Del Usoerror.Validate3=<li> {0}</li>error.Validate2=<li> {0}</li>error.Validate1=<li> {0}</li>error.Validate0=<li>{0}</li>errors.header=<h3><font color\="red">Error De la Validación</font></h3>Usted debe corregir el error(es) siguiente antes de proceder\:<ul>errors.prefix=<li>globalerror.jboException=Error Del Usoerrorpage.message=Mensaje De Error\:errors.footer=</ul><hr>errors.suffix=</li>
titleGlobal=Acontecimientos De la Gerencia De ProductotitleBrowseEvents=Hojee Los Acontecimientos (Página Principal)titleAddPaper=Agregue El PapeltitleSelectAnd=Seleccione y
globalbuttonBrowsePM=Hojee los PMglobalbuttonBrowsePaper=Hojee Los PapelesglobalbuttonBrowseEvent=Hojee Los Acontecimientos
buttonSubmit=SometabuttonCancel=CancelaciónbuttonAdd=AgreguebuttonDelete=QuitebuttonEdit=Corrija
A Translated PropertyResourceBundle
![Page 32: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/32.jpg)
Exercise 5
Creating and Localizing a PropertyResourceBundle
![Page 33: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/33.jpg)
Multi-lingual Web Application Design Considerations
Typical Multilingual Implementations: Clone & Translate User Selects Language / Locale at Home
Page Language / Locale Set to Browser preferred
Language/Locale Settings Repository based locale preference lookup
![Page 34: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/34.jpg)
Design Option: Clone and Translate
en_US ja_JP es_ESfr_FR
Index.jsp Index.jsp Index.jsp Index.jsp
![Page 35: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/35.jpg)
Design Option: One JSP / Multiple Languages
Index.jsp
Resources.properties
Resources_es_ES.properties
Resources_ja_JP.properties
Resources_fr_FR.properties
![Page 36: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/36.jpg)
Design Option: One JSP per language, w/ResouceBundles
Index.jsp
Resources.properties
Resources_es_ES.properties
Resources_ja_JP.properties
Resources_fr_FR.properties
Index_es.jsp
Index_ja.jsp
Index_fr.jsp
![Page 37: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/37.jpg)
Exercise 6
Create Page with User Selected Language
![Page 38: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/38.jpg)
JSTL – JavaServer Pages Standard Tag Library
Collection of standard JSP actions Latest version 1.1 Main libaries:
– XML processing support: “xml” library– SQL DBMS access: “sql” library– Variable manipulation, flow control, URL
actions: “core” library– I18n and formatting: “fmt” library
![Page 39: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/39.jpg)
JSTL – i18n Tags I18n and L10n support Prefix = fmt Support for:
– Setting locale context– Fetching locale context sensitive content– Handling locale specific numeric and date formatting
Many functions reused by other tag libraries:– Struts <bean:message> tag– Jakarta i18n Tags
At top of JSP, specify the tag library directive :<%@ taglib uri="http://java.sun.com/jstl/fmt"
prefix="fmt"%>
![Page 40: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/40.jpg)
JSTL Locale
<fmt:setLocale value=“en_IE" scope="session" />
– Scope default is “page”– Optional variant attribute
<fmt:requestEncoding value=“UTF-8”/>
– value attribute is optional
![Page 41: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/41.jpg)
JSTL Resource
Set the base bundle:<fmt:setBundle basename=“strings” scope=“session”/>
Replace the hard coded strings in the JSP with the <fmt:message>
<fmt:message key="buttonsubmit"/>
Pass parameters:<fmt:message key=“Totals">
<fmt:param value=“${subtotal_1}”/>
<fmt:param value=“${subtotal_2}”/>
</fmt:message>
![Page 42: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/42.jpg)
JSTL Format
Format date for output:<fmt:formatDate value=“${now}” type=“date”
datestyle=“short”/>
Parse submitted date<fmt:parseDate value=“${param.birthday}” type=“date”
pattern=“yyy-MM-dd”/>
Format Numbers<fmt:formatNumber value=“200.00” type=“currency”
currencySymbol=“£”/>
Parse Numbers<fmt:parseNumber value=“${param.carPrice”}
type=“currency” parseLocale=“en_IE”/>
![Page 43: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/43.jpg)
Struts <bean> tag
The same as JSTL <fmt:message> tag Configure ResourceBundle location in Struts-
Config.xml file<message-resources
parameter="view.ApplicationResources"/>
At top of JSP, add this directive:<%@ taglib uri="/WEB-INF/struts-bean.tld"
prefix="bean“%>
Then replace hard coded strings with <bean:message key="empmaintitle"/>
![Page 44: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/44.jpg)
Jakarta i18n tag Library
i18n tags similar to Struts “message” tag, but more robust
Use in JSP’s - Struts not required Includes many JSTL i18n tags I18n Management Tags:
– Ifdef, Ifndef, Locale, Message, Bundle, MessageArg
Formatting Tags:– FormatDateTime, FormatDate, FomatTime,
FormatCurrency, FormatPercent, FormatNumber, FormatString
![Page 45: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/45.jpg)
Specifying location of resources in Struts / JSP Define message file locations in struts-config.xml A <message-resources> element with no key
attribute defines the default message resource. Secondary message resources identify their key by
specifying a value for the key attribute.<struts-config> : <!-- | This entry tells Struts where to find the default application | resources properties file +--> <message-resources parameter=“view.ApplicationResources"/> <!-- | Resource used to render globals errors with <html:errors> +--> <message-resources key="GlobalErrors" parameter=“view.GlobalErrors"/></struts-config>
![Page 46: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/46.jpg)
PropertyResourceBundles in Struts/JSP
PropertiesResourceBundles may be referenced in the JSP page by using <bean:message> tag:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %><html> <head> <title><bean:message key="accountcreated.title"/></title> </head> <body> <jsp:include page="header.jsp" flush="true"/> <jsp:include page="navbar.jsp" flush="true"/> <h2><bean:message key="accountcreated.header"/></h2> <br><br> <a href="home.do"><bean:message key="accountcreated.gotomainpage"/></a> </body></html>
![Page 47: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/47.jpg)
PropertyResourceBundles and JSTL / Struts / JSP
Declare the custom JSTL library in the JSP header
<fmt:bundle> defines resource location within <body>. Optional “prefix” attribute simplifies key name
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%><%@ page contentType="text/html;charset=UTF-8"%><%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body><fmt:bundle basename="view.ApplicationResources" prefix='header.'> <H1><fmt:message key='maintitle'/></H1>
...</fmt:bundle> </body></html>
<fmt:message> specifies the resources
![Page 48: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/48.jpg)
Exercise 7
Internationalize and Localize JSP using tags
![Page 49: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/49.jpg)
Oracle ADF-UIX ComponentsPre-translated content - Over 30 languages supported
Loads resources based on browser setting
Limit language support by configuring uix-config.xml
<supported-locales>
<default-locale>en-US</default-locale>
<supported-locale>es</supported-locale>
</supported-locales>
Simplifies development, i18n, l10n
Extends Java Server Faces
Seamless upgrade to full JSF
![Page 50: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/50.jpg)
<?xml version="1.0" encoding=“UTF-8"?><page xmlns="http://xmlns.oracle.com/uix/controller" xmlns:ui="http://xmlns.oracle.com/uix/ui" xmlns:ctrl="http://xmlns.oracle.com/uix/controller" xmlns:html="http://www.w3.org/TR/REC-html40" expressionLanguage="el"> <content> <dataScope xmlns="http://xmlns.oracle.com/uix/ui"> <provider> <data name="nls"> <bundle class="view.ApplicationResources"/> </data> </provider> ... <metaContainer> <!-- Set the page title --> <head title="${uix.data.nls.titleGlobal}"/> </metaContainer> ...
PropertyResourceBundles in Struts / ADF UIX
Define provider in each UIX file
Reference using ${uix.data.<provider>.<key name>}
![Page 51: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/51.jpg)
Exercise 8
Internationalize and Localise a UIX Page
![Page 52: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/52.jpg)
JDeveloper 10g IDE L10N Features
Real-time access to resource bundles
![Page 53: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/53.jpg)
package model.common;import oracle.jbo.common.JboResourceBundle;// ---------------------------------------------------------------------// --- File generated by Oracle ADF Business Components Design Time.// --- Custom code may be added to this class.// ---------------------------------------------------------------------public class EmployeesImplMsgBundle extends JboResourceBundle{ /** * * This is the default constructor (do not remove) */ public EmployeesImplMsgBundle() { } /** * @return an array of key-value pairs. */ public Object[][] getContents() { return super.getMergedArray(sMessageStrings, super.getContents()); } static final Object[][] sMessageStrings = { {"Salary_FMT_FORMAT", "$ #,##,###,####.00"},
JDeveloper 10g IDE L10N Features
Generates List Resource Bundle from Entity Editor
![Page 54: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/54.jpg)
Large Project Considerations
Include i18n and l10n in design phase Commence i18n and l10n work early Create a separate properties files for each module /
subsystem Never check in code with static text Implement Pseudo Translation test cycle early in the
development project cycle, and repeat often. Reuse previous translations using commercial
Translation / Localisation tools
![Page 55: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/55.jpg)
L10n Productivity Toolse.g., Alchemy Software Catalyst 5.0
![Page 56: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/56.jpg)
Localization Tool Features- Pseudo Translation
Most L10n tools support the validation of the internationalization of your application by Pseudo Translating it. Pseudo Translation enables your development team to run a test cycle early in the development project cycle, before a single word is translated.
![Page 57: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/57.jpg)
Localization Tool Features- Resource Format Support
Ensure the tool you choose correctly interprets resource bundles.Most tools provide customizable input and output filters which can easily support both PropertiesResourceBundles and ListResourceBundlesConsider transforming resources to / from XLIFF, the XML Localization Interchange File Format emerging standard (www.xliff.org)
![Page 58: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/58.jpg)
Localization Tool Features- Translation Memory
3rd party localization tools will often provide tools for reusing previous translations when your project changes. Frequently retranslating your strings when versions change is a needless expense. Translation Memory provides reuse of existing translations.
![Page 59: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/59.jpg)
Localization Tool Features - Automation
Automation and scripting are important when you need to maintain consistency of your process across many different languages, or when you have many individual files being sent out to translators as well as translations coming back in that must be integrated into your application.
![Page 60: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/60.jpg)
AQ&
![Page 61: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/61.jpg)
Resources for further study Oracle Tech Net Whitepaper:
http://otn.oracle.com/products/jdev/collateral/papers/10g/jdev10g_multilingual.pdf
“The Multilingual World Wide Web“, Gavin Nicol, http://www.oasis-open.org/cover/nicol-multwww.html
W3C: http://www.w3c.org/international “Best Practices in Internationalizing Web-Based
EnterpriseApplications”, Greg Murray: http://java.sun.com/javaone/javaone2001/pdfs/2335.pdf
“J2EE Internationalization and Localization”, Greg Murray: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/i18n/i18n5.html
![Page 62: Localizing J2EE Web Applications Tony Jewtushenko Principal Product Manager LRC Localisation Summer School, June 2004](https://reader035.vdocuments.mx/reader035/viewer/2022062714/56649d145503460f949e940c/html5/thumbnails/62.jpg)
Oracle Resources
Oracle Technology Network:
http://otn.oracle.com Download Jdeveloper 10g
http://otn.oracle.com/software/products/jdev/index.html
JDeveloper 10g White papers, samples, product information: http://otn.oracle.com/products/jdev/index.html