building global multilingual internet applications
TRANSCRIPT
The Power To The Power To DevelopDevelop
i
Develop2000
Adopted for IUC17
Simon K. Simon K. WongWongPrincipal Principal Member ofMember ofTechnical StaffTechnical StaffOracle Oracle CorporationCorporation
Building Global Multilingual Internet Applications on
Oracle8i
Agenda
Basic architecture for multilingual Internet Basic architecture for multilingual Internet ApplicationsApplications
Issues in supporting multiple languages Issues in supporting multiple languages simultaneously and how they are simultaneously and how they are resolved.resolved.
Multilingual demo using Java ServletsMultilingual demo using Java ServletsSummary Summary
Multilingual Internet Application for E-BusinessCentralized database serverCentralized database server
Consolidate information from around the world Consolidate information from around the world with a single global database.with a single global database.
Multilingual middle tier application serverMultilingual middle tier application serverReduce the cost of maintaining multiple code Reduce the cost of maintaining multiple code
bases, each serves a single language.bases, each serves a single language.Easily extended to support additional Easily extended to support additional
language. language.
Application Architecture
English (USA)English (USA)
German (Germany)German (Germany)
HTTPHTTPNet8Net8
Browser Browser Multilingual Middle Multilingual Middle Tier Application ServerTier Application Server
CentralizedCentralizedDatabase ServerDatabase Server
Japanese (Japan)Japanese (Japan)
Oracle8Oracle8ii
Application Requirements
Locale sensitiveLocale sensitivelanguage language cultural convention cultural convention
A single universal character set - UnicodeA single universal character set - UnicodeFixed width UTF-16Fixed width UTF-16Variable width UTF-8Variable width UTF-8
Application Architecture
UTF8 UTF8
German content German content in UTF8in UTF8
English (USA)English (USA)
German (Germany)German (Germany)HTTPHTTP
Net8Net8
English content English content in UTF8 in UTF8
Browser Browser Middle Tier Application ServerMiddle Tier Application Server Database ServerDatabase Server
Japanese content Japanese content in UTF8 in UTF8
Japanese (Japan)Japanese (Japan)
Oracle8Oracle8i i UTF8UTF8
PSP, Stored PSP, Stored Procedures Procedures
JSP,JSP,Java ServletJava Servlet
Oracle iASOracle iAS
Oracle8i Multilingual CapabilitiesUnicode data storage - UTF8Unicode data storage - UTF8Cultural ConventionsCultural Conventions
Monetary and Numeric FormatsMonetary and Numeric FormatsDate, Time and Calendar FormatsDate, Time and Calendar FormatsLinguistic SortingLinguistic Sorting
Linguistic IndexLinguistic IndexDevelopmentDevelopment Environments Environments
JSP and Java ServletJSP and Java ServletPSP and PL/SQLPSP and PL/SQL
Monetary and Numeric Formats
$Y
C NLS_CURRENCYNLS_CURRENCYNLS_ISO_CURRENCYNLS_ISO_CURRENCYNLS_DUAL_CURRENCYNLS_DUAL_CURRENCY
10,000.00
5.000,00
25,000.00
NLS_NUMERIC_CHARACTERSNLS_NUMERIC_CHARACTERS
Date, Time and Calendar Formats
mon.dd.yyyymon.dd.yyyydd-mon-yyyydd-mon-yyyy
yyyy-mm-ddyyyy-mm-ddNLS_DATE_FORMATNLS_DATE_FORMAT
Day, Month, yyyyDay, Month, yyyy
SundaySunday
DomingoDomingo
NLS_DATE_LANGUAGENLS_DATE_LANGUAGE
Japanese ImperialJapanese ImperialGregorianGregorian
Thai BhuddaThai Bhudda
Arabic HijrahArabic Hijrah
PersianPersian
NLS_CALENDARNLS_CALENDAR
Linguistic Sorting
Spanish
ChaconChavez
Cordoba
LlamaLuna
German
..AhrenfeldtAbelt
..BackerBaecker
BeckerStrabenburgStrassenfeld
NLS_SORTNLS_SORT
Linguistic Index
Multiple linguistic indexes enable fast Multiple linguistic indexes enable fast linguistic sorting.linguistic sorting.CREATE INDEX SP_INDX ON CUSTOMER (NLSSORT(NAME,‘NLS_SORT=SPANISH’));
CREATE INDEX GE_INDX ON CUSTOMER (NLSSORT(NAME, ‘NLS_SORT=GERMAN’));
Oracle8Oracle8ii selects the index based on the selects the index based on the NLS_SORT session parameter. NLS_SORT session parameter. SELECT ID, NAME FROM CUSTOMER ORDER BY NAME;
JSPs and Java Servlets
Oracle iAS integrates the Apache web Oracle iAS integrates the Apache web server withserver with
JSERV module: Servlet API 2.2 Internationalization support
OJSP: JSP 1.1 Internationalization supportJDBC transparently converts UTF8 data to JDBC transparently converts UTF8 data to
UTF16 encoded Java StringUTF16 encoded Java String
PSPs and PL/SQL Stored Procedures
Oracle iAS allows web applications written Oracle iAS allows web applications written in PL/SQL stored procedures. in PL/SQL stored procedures.
Web gatewayWeb Toolkit
PL/SQL Server Page (PSP) is similar to JSPs PL/SQL Server Page (PSP) is similar to JSPs in Java.in Java.
HTML with embedded PL/SQL code. HTML with embedded PL/SQL code. Compile to stored procedure when deployedCompile to stored procedure when deployed
Access database via SQL in UTF8.Access database via SQL in UTF8.
Agenda
Basic architecture for multilingual Internet Basic architecture for multilingual Internet applicationsapplications
Issues in supporting multiple languages Issues in supporting multiple languages simultaneously and how they are simultaneously and how they are resolved.resolved.
Multilingual demo using Java ServletsMultilingual demo using Java ServletsSummary Summary
Basics for Multilingual Support in an Internet Application
Dynamic User Locale Determination and Dynamic User Locale Determination and SynchronizationSynchronization
Content in Different LanguagesContent in Different LanguagesEncoding TaggingEncoding TaggingForm Input and Query String HandlingForm Input and Query String Handling
Locale Determination and Synchronization
French French (Switzerland)(Switzerland)
User Input fr-ch
Accept Language HTTP header: fr-ch
User Profilefr-ch
Determine Locale
1
3 2 User profile table
Java : new Locale(“fr”, “ch”)
ALTER SESSION SET NLS_LANGUAGE=FRENCHNLS_TERRITORY=SWIZTERLANDSynchronize Locale
Oracle8Oracle8i i
Maintaining the User Locale
Carry locale information from one HTML Carry locale information from one HTML page to another. Why?page to another. Why?
Determine locale only once to minimize Determine locale only once to minimize performance impact.performance impact.
Make locale information readily available.Make locale information readily available.Two common ways: Two common ways:
Specify the locale in a query string of a URL.Specify the locale in a query string of a URL.Set a cookie to reflect the user locale.Set a cookie to reflect the user locale.
Content in Different Languages
Static HTML and image files are readily Static HTML and image files are readily translatable.translatable.
Externalize translatable strings from JSPs Externalize translatable strings from JSPs and servlets to resource bundles.and servlets to resource bundles.
Externalize translatable strings from PSPs Externalize translatable strings from PSPs and stored procedures to a message table and stored procedures to a message table in the database.in the database.
Enhance database schema for tables where Enhance database schema for tables where dynamic data should be translateddynamic data should be translated.
Enhanced Schema
Product ID Product Name
AA12228 Digital CameraAmerican
.
...
.
.
AA12228 T. Chinese
AA12228 Italian Macchina fotografica digitale
AA12228 Japanese
Lang IDLang ID
AddAdd
AA12228 Russian
Dynamic Content Selection
Reference to translated version of the static Reference to translated version of the static HTML and image files.HTML and image files.
In Java Servlets and JSPs, get resources In Java Servlets and JSPs, get resources from the resource bundle of the desired from the resource bundle of the desired language.language.
In PSP and stored procedures, select In PSP and stored procedures, select translated messages from the message translated messages from the message table using the appropriate language ID.table using the appropriate language ID.
For dynamic data in the database, select the For dynamic data in the database, select the translated data using the appropriate translated data using the appropriate language ID.language ID.
Encoding Tagging
Why is it important? It tells the browserWhy is it important? It tells the browserto use the correct font to display the page.to use the correct font to display the page.to apply the correct character conversion to apply the correct character conversion
functions for the page.functions for the page.to correctly encode user input for a HTML form.to correctly encode user input for a HTML form.
Two ways to tag the character encoding:Two ways to tag the character encoding:Tag it in the HTTP content-type header.Tag it in the HTTP content-type header.Tag it in the HTML header.Tag it in the HTML header.
Encoding Tagging
Content-Type: text/html; charset=utf-8
JSP and PSP: <%@ page content-type=“text/html; charset=utf-8”%>Java Servlet: ServletResponse.setContentType ("text/html; charset=utf-8");
Stored Procedure:owa_util.mime_header(‘text/html’, false, ‘utf-8’))
1. HTTP Header
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8”>
2. HTML Header
Oracle8Oracle8iiinin
UTF8UTF8
Form Input Handling
Form input is encoded in the encoding of Form input is encoded in the encoding of the form.the form.
Form input should be interpreted as UTF8 Form input should be interpreted as UTF8 bytes in the application.bytes in the application.
Form Input Handling in Java
JSP and Java Servlets assume ISO-8859-1 JSP and Java Servlets assume ISO-8859-1 for the form input and convert them to for the form input and convert them to UTF-16 encoded Java Strings.UTF-16 encoded Java Strings.
Workaround: Convert the form input to use Workaround: Convert the form input to use the correct encoding as follows:the correct encoding as follows:original = request.getParameter(“name”);
strName = String( original.getBytes(“ISO8859_1”), “UTF8”)
Form Input Handling in PSP and Stored ProceduresOracle iAS ensures UTF8 bytes are passed Oracle iAS ensures UTF8 bytes are passed
to the UTF8 database.to the UTF8 database.Form input and query strings are passed as Form input and query strings are passed as
UTF8 via stored procedure arguments.UTF8 via stored procedure arguments.
Query Strings in URL
Query strings sometimes are used as a Query strings sometimes are used as a redirect request or a link in a HTML page.redirect request or a link in a HTML page.
Encode non-ASCII UTF8 bytes of a query Encode non-ASCII UTF8 bytes of a query string using the %XX format string using the %XX format where XX is where XX is hexadecimal digits for the binary value of the hexadecimal digits for the binary value of the bytes.bytes.
http://<host.domain>/htmlpage?name= Schloßhttp://<host.domain>/htmlpage?name= Schloßhttp://<host.domain>/htmlpage?name= Schlo%c3%9fhttp://<host.domain>/htmlpage?name= Schlo%c3%9f
D E M O N S T R A T I O N
Getting Personal
On Your Web Site
Agenda
Basic architecture for multilingual Internet Basic architecture for multilingual Internet ApplicationsApplications
Issues in supporting multiple languages Issues in supporting multiple languages simultaneously and how they are simultaneously and how they are resolved.resolved.
Multilingual demo using Java ServletsMultilingual demo using Java ServletsSummary Summary
Summary
Internet applications should be globalized to Internet applications should be globalized to reach out global customers.reach out global customers.
A global internet application requires:A global internet application requires:
Unicode data storage in the databaseUnicode data storage in the databaseSupport multiple culture conventions Support multiple culture conventions
simultaneouslysimultaneouslyUnicode support in programming environment Unicode support in programming environment
l JSP and Java Servlets using JDBCJSP and Java Servlets using JDBCl PSP and PL/SQL stored procedures using SQLPSP and PL/SQL stored procedures using SQL
The Power To The Power To DevelopDevelop
i
Develop2000
Adopted for IUC17