SlideShare a Scribd company logo
1 of 40
Download to read offline
Learn to Internationalize your
Java, JavaFX, AJAX and Portlet
Applications
                    Shankar Gowda & Shrinath Hedge
                    Globalization Engineering
                    Sun Microsystems, Inc.
Agenda
  Globalization Overview
>
  What's with acronyms and definitions ?
>
  How do they differ and relate ?
>
  Introducing Internationalization(i18n) in various technologies
>
  Language Exercises (100 mins)
>
        – Exercise 0: Setup Lab Environments
        – Exercise 1: Internationalize your Java application
        – Exercise 3: Internationalize AJAX Web application
        – Exercise 4: Internationalize Portlet application
        – Exercise 2: Internationalize JavaFX application
> Tools, Summary and References



                                                                   2
Globalization acronyms
Globalization [G1 1 n]
  “Globalization addresses the business issues associated with taking a
    product global. In the globalization of high-tech products this involves
    integrating localization throughout a company, after proper
    internationalization and product design, as well as marketing, sales, and
    support in the world market.”

Internationalization [i1 8n]
  “Internationalization is the process of generalizing a product so that it can
     handle multiple languages and cultural conventions without the need for
     re-design. Internationalization takes place at the level of program design
     and document development.”

Localization [L1 0n]
  “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.”

Translation ===> T9n
                                                                                  3
How do they differ and relate ?
• Globalization at the architecture level
• Internationalization ( 8n)enables Localization
                       i1
• An expert in i1 8n may not be an expert in l1 0n
• I18n (code) + l10n(linguistic) + T9n (translation)
                 = G11n (process)




                                                       4
Internationalization support in Java
      Java Platform is Internationalized
  ➢



          Extensive library of classes and functions
      ●




          I18n support comes for free or at very little cost
      ●




          Built-in I18n support for over 70 languages
      ●




      All text in a running Java program is Unicode
  ➢




                                                               5
Concept of Resource Bundle




                             6
Example Code: Before Internationalization

         System.out.println(“Hello”);

         System.out.println(“Sun Tech Days”);

         System.out.println(“Hyderabad”);




                                                7
Example Code: After Internationalization
Locale myLocale = new Locale(myLanguage, myCountry);

ResourceBundle messages =
   ResourceBundle.getBundle(“messageBundle, myLocale);

System.out.println(messages.getString(“greeting”));
System.out.println(messages.getString(“event”));
System.out.println(messages.getString(“place”));

Your Resource Bundle property catalog file will have,
greeting=Hello
event=Sun Tech Days
place=Hyderabad


                                                        8
Introduction to AJAX
  > AJAX = acronym for
     Asynchronous JavaScript and XML
          – Browser client uses JavaScript to Asynchronously
          – get XML data from a server and update page
          – dynamically without refreshing the whole page
  > Why is AJAX so popular ?
         – Increase Usability of Web Application
         – Save Bandwidth
         – Download only data you need
         – End user Sequence and Faster interfaces
  > Side effects of AJAX ?
         – Breaks back button support
         – URL's don't change as state changes
         – Cross Browser Issues can be a pain



                                                               9
User Interface: Traditional Web Vs AJAX




                                          10
Traditional Web   AJAX
                          within a browser,
                         there is AJAX engine




                                            11
AJAX Internationalization
• Server Side: By setting the appropriate Request
 and Response Object to a right encoding in
 Servlet controller
  > In doGet method
         – request.setCharacterEncoding(“UTF-8”);
  > In sendResonse method
         – response.setContentType(“text/xml;
           charset=utf-8”);
  > Using Resource Bundle for externalizing messages to
    property files and naming them to appropriate locale
    variant.
• Client Side: By setting your browser to UTF-8
 encoding.

                                                           12
Introducing Portlet Application
> Specialized Web application that
  provides value-added services like,
       – Personalization, Single Sign-On,
         Content Aggregation, Dynamic
         Drag and Drop, Work From
         Desktop, Search& Tagging.
> Portlet is a piece of markup called
  as 'Fragment'
> A Portal Application can have
  multiple portlets.
       – Window functionalities like,
         minimize, maximize, configure,
         close..etc
> Portal Administration for Role, Look
  & Feel, Permissions, SOA, JAI
> Includes Wikis, Message Boards,
  Blogs, Email, IM, Activity Tracking,
  Calendar, etc..                           13
Hindi Portal Application




                           14
Internationalizing your Portlet
> Server Side: By setting the appropriate Resquest and
  Response Objects to right encoding in Servlet/JSP
  controller.
       – Adding locale support in your portlet.xml
          <supported-locale>hi</supported-locale>
       – JSP Page Directive
          <%page contentType=”text/html; charset=UTF-8”%>
          <%page pageEncoding=”UTF-8” %>
       – Using JSTL FMT library
          <% taglib uri=”http://java.sun.com/jsp/jstl/fmt”
            prefix=”fmt” %>
       – Setting Resource Bundle
          <fmt.setBundle basename=”PackageName.BundleName” />
       – Calling the tag lib in your JSP page
          <fmt:message key=”name”/>
> Client Side: Set your browser encoding to UTF-8.

                                                             15
Let us start the LAB with Exercise 0
> Install Java SE 6 update 10 or above
> Install NetBeans 6.5 with GlassFish V2/V3
> Copy i18nHOL.zip and
 unzip
      – Will create i18nHOL
        directory =
        <lab_root>
      – It contains the following:
      – Start with index.html
      – Exercises directory like




                                              16
Excrcise 1: Learn to Internationalize your
Java Application




                                             17
Exercise 3: Learn to Internationalize your
AJAX enabled Web Application




                                             18
Exercise 4: Learn to Internationalize your
Portlet Application




                                             19
Lastly, let us take to JavaFX Lab Session




                                            20
JavaFX Overview
    JavaFX platform           FX
●


      JavaFX Desktop
    ●

    ● JavaFX Mobile and JavaFX TV

    ● Other devices and screens to follow


    Tools Suite
●


      JavaFX Developer (Plug-ins for IDEs, Media
    ●

      converters, RAD tools)
    ● JavaFX Designer (Authoring, Video

      Encoding)
    Suite of Applications build on JavaFX
●

    ● JavaFX Content, Applications & Services




                                                   21
Single Virtual Machine/ byte code




                                    22
JavaFX Script Programming Language
   Declarative, statically-typed scripting language
 >
   Facilitates rapid GUI development
 >
   Many cool, interesting language features
 >
   Runs on Virtual Machine for the Java™ platform
 >
   Deployment options same as Java programs
 >
   Fully utilizes Java class libraries behind the scenes
 >
   For content designers and Media engineers
 >
   Supports primitive types like, String, Boolean, Number,
 >
   Integer, Duration.
 > Supports Objects, Multiple Inheritance and any Java
   Objects can be used in JavaFX.



                                                             23
Comparision of Java, Swing and JavaFX




                                        24
Introducing Internationalization in JavaFX
  > Creating a Locale Object
  > Setting the default locale




  > Create Resource Bundle property file as
    “Main_hi_IN.fxproperties”
  > Resource bundle messages are called just by
    prefixing with '##'
  > Reduces complexity! Compared to Java Resource
    Bundle


                                                    25
Internationalizing Dates in JavaFX
   > Supports Java printf-style formats
   > Uses same Formatter as Java
   > POSIX standard strftime spec.




                                          26
Internationalizing of Dates in JavaFX
• Formats
        – %tx – Locale's appropriate date representation
        – %tX – Locale's appropriate time representation
        – %tg – The last two digits of the week-based year (ISO 8601)
        – %tG – Week-based year (ISO 8601)
        – %tu – Day of week ( Monday is 1) [ 1,7 ]
        – %tV – ISO 8601 Week number of the Year.




                                                                   27
Looking at locale based sorting for JavaFX
  > Create a List of words
  > Create the Instance of Collator by specifying the
    Locale.
  > Define the function for Sorting and displaying the List
    of words.




                                                              28
Locale based Sorting using Collator
  > In sort function we will call Collections.sort, that sorts
    the list of words in ascending order by giving the
    words list and strength of the collator as arguments.
  > Append the output to a variable.




                                   > Display as,




                                                                 29
Exercise 2: Learn to i18n JavaFXSphere
• Install, Configure Lab environment
• Creating a FirstJavaFXSphere Application
• Internationalizing the code of FirstJavaFXSphere
  application
• Externalizing the messages to
  Main_hi_IN.fxproperties
• Localizing in Hindi




                                                     30
Internationalization References
    Sun Software Globalization
•
              – http://developers.sun.com/techtopics/global/

    Software Globalization - Architecture, Design,Testing
•
              – http://developers.sun.com/techtopics/global/technology/arch/

    Software Globaliation- Sun Java Enterprise System
•
              – http://developers.sun.com/techtopics/global/products_platforms/jes/

    Sun Software Product Internationalization Taxonomy
•
              – http://developers.sun.com/dev/gadc/des_dev/i18ntaxonomy

    Java Internationalization
•
               – http://java.sun.com/javase/technologies/core/basic/intl/

    Subscribe to Software globalization NewsLetter
•
              – http://developers.sun.com/dev/gadc/subscribe/index.html

    Technical articles on Java Internationalization
•
              – http://java.sun.com/developer/technicalArticles/Intl/

    Java Internationalization Tutorial
•
               – http://java.sun.com/docs/books/tutorial/i18n/index.html


                                                                                      31
JavaFX References
    http://javafx.com/
•

    https://openjfx.dev.java.net/
•

    http://openjfx-compiler.dev.java.net
•

    http://scenegraph.dev.java.net
•

    http://java.sun.com/javafx/
•

    http://java.sun.com/javafx/tutorials/project_nile_integrating_graphics/
•

    http://openjfx.java.sun.com/current-build/doc/index.html
•




                                                                              32
AJAX References
    The BluePrints Solutions catalog on AJAX
•
             – https://bpcatalog.dev.java.net/nonav/solutions.html

    AJAX Q & A
•
               – https://blueprints.dev.java.net/ajax-faq.html

    Asynchronous JavaScript Technology and XML (AJAX) with Java 2 Platform,
•
    Enterprise Edition
               – http://java.sun.com/developer/technicalArticles/J2EE/AJAX/Intro_Ajax
                 _PageAuthors.pdf
    AJAX Frameworks
•
             – http://ajaxpatterns.org/wiki/index.php?title=AJAXFrameworks

    AJAX Library and Frameworks Comparison
•
              – http://wiki.osafoundation.org/bin/view/Projects/AjaxLibraries

    AJAX Developer Resource Center
•
            – http://developers.sun.com/ajax/

    JavaScript Developer Site
•
               – http://java.sun.com/javascript



                                                                                    33
Portlet References
    http://javafx.com/
•

    https://openjfx.dev.java.net/
•

    http://openjfx-compiler.dev.java.net
•

    http://scenegraph.dev.java.net
•

    http://java.sun.com/javafx/
•

    http://java.sun.com/javafx/tutorials/project_nile_integrating_graphics/
•

    http://openjfx.java.sun.com/current-build/doc/index.html
•




                                                                              34
Q&A

      35
Shankar Gowda MBN
●

● Shrinath Hedge

●




                      36
Backup of JavaFX




                   37
JavaFX: Command Line Development
    include <javafx-sdk>/bin in PATH
•
    javafxc to compile
•
    javafx to run
•
    Relevant library files in <javafx-sdk>/lib are
•
    automatically included in classpath as necessary.
    Rest can be included with the -classpath option
    > With packages
      ● javafxc -d . firstjavafxsphere/Main.fx
      ● javafx firstjavafxsphere.Main
    > Without packages
      ● javafxc Main.fx
      ● javafx Main



                                                        38
JavaFX: FirstJavaFXSphere.jnlp (applet)
<jnlp href=quot;test.jnlpquot;>
  <information>...
  </information>
  <resources>
    <j2se version=quot;1.6+quot; href=
  quot;http://java.sun.com/products/autodl/j2sequot; />
    <jar href=quot;FirstJavaFXSphereApplet.jarquot; main=quot;truequot; />
    <jar href=quot;javafxrt.jarquot; />
    <jar href=quot;javafxgui.jarquot; />
    <jar href=quot;javafx-swing.jarquot; />
    <jar href=quot;Scenario.jarquot; />
  </resources>
  <applet-desc
    name=test
    main-class=quot;javafx.application.Appletquot;
    width=500
    height=500>
  </applet-desc>
</jnlp>


                                                             39
JavaFX: FirstJavaFXSphere.html (Applet
call)
<html>
  <head>
    <title>FX Script Applet Test</title>
  </head>

  <body bgcolor=quot;#000000quot;>
    <h1>FX Script Applet Test</h1>
    <center>
      <applet width=quot;640quot; height=quot;480quot;>
        <param name=quot;jnlp_hrefquot;
value=quot;FirstJavaFXSphere.jnlpquot;>
        <param name=quot;ApplicationClassquot;
               value=quot;FirstJavaFXSphereAppletquot;>
      </applet>
    </center>
  </body>
</html>


                                                  40

More Related Content

What's hot

Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutesglassfish
 
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009Alexandre Morgaut
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nationArun Gupta
 

What's hot (6)

Fifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 MinutesFifty Features of Java EE 7 in 50 Minutes
Fifty Features of Java EE 7 in 50 Minutes
 
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
Wakanda: a new end-to-end JavaScript platform - JSConf Berlin 2009
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
Intro To Grails
Intro To GrailsIntro To Grails
Intro To Grails
 
Java EE 6 Aquarium Paris
Java EE 6 Aquarium ParisJava EE 6 Aquarium Paris
Java EE 6 Aquarium Paris
 
5050 dev nation
5050 dev nation5050 dev nation
5050 dev nation
 

Viewers also liked

Create, Publish, Communicate
Create, Publish, CommunicateCreate, Publish, Communicate
Create, Publish, Communicatepennyryder
 
Learn to Internationalize your Applications - Sun Tech Days 2009
Learn to Internationalize your Applications - Sun Tech Days 2009Learn to Internationalize your Applications - Sun Tech Days 2009
Learn to Internationalize your Applications - Sun Tech Days 2009shankar_mbn
 
An Information Report About The Sun
An Information Report About The SunAn Information Report About The Sun
An Information Report About The Sunpennyryder
 
Frame Shop&Gallery Presentation
Frame Shop&Gallery PresentationFrame Shop&Gallery Presentation
Frame Shop&Gallery Presentationguest9745bb
 

Viewers also liked (9)

Brechas Tic
Brechas TicBrechas Tic
Brechas Tic
 
Google
GoogleGoogle
Google
 
Create, Publish, Communicate
Create, Publish, CommunicateCreate, Publish, Communicate
Create, Publish, Communicate
 
Learn to Internationalize your Applications - Sun Tech Days 2009
Learn to Internationalize your Applications - Sun Tech Days 2009Learn to Internationalize your Applications - Sun Tech Days 2009
Learn to Internationalize your Applications - Sun Tech Days 2009
 
Welcome1
Welcome1Welcome1
Welcome1
 
Présentation iPhone
Présentation iPhonePrésentation iPhone
Présentation iPhone
 
An Information Report About The Sun
An Information Report About The SunAn Information Report About The Sun
An Information Report About The Sun
 
Witches
WitchesWitches
Witches
 
Frame Shop&Gallery Presentation
Frame Shop&Gallery PresentationFrame Shop&Gallery Presentation
Frame Shop&Gallery Presentation
 

Similar to Internationalize Java, JavaFX, AJAX and Portlet Applications

Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
Building Rich Internet Applications Using Google Web Toolkit
Building Rich Internet Applications Using  Google Web ToolkitBuilding Rich Internet Applications Using  Google Web Toolkit
Building Rich Internet Applications Using Google Web Toolkitrajivmordani
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1rajivmordani
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshopAssaf Gannon
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Stephen Chin
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascriptrajivmordani
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Toolsbarciszewski
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008Association Paris-Web
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
Net Beans61 Ide
Net Beans61 IdeNet Beans61 Ide
Net Beans61 Idesatyajit_t
 
GWT Training - Session 1/3
GWT Training - Session 1/3GWT Training - Session 1/3
GWT Training - Session 1/3Faiz Bashir
 
GWT training session 1
GWT training session 1GWT training session 1
GWT training session 1SNEHAL MASNE
 
HTML5 Introduction
HTML5 IntroductionHTML5 Introduction
HTML5 Introductionbeforeach
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for youSimon Willison
 
Galaxy
GalaxyGalaxy
Galaxybosc
 

Similar to Internationalize Java, JavaFX, AJAX and Portlet Applications (20)

Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Open Social Summit Korea
Open Social Summit KoreaOpen Social Summit Korea
Open Social Summit Korea
 
Building Rich Internet Applications Using Google Web Toolkit
Building Rich Internet Applications Using  Google Web ToolkitBuilding Rich Internet Applications Using  Google Web Toolkit
Building Rich Internet Applications Using Google Web Toolkit
 
Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1Java Fx Ajaxworld Rags V1
Java Fx Ajaxworld Rags V1
 
Fullstack workshop
Fullstack workshopFullstack workshop
Fullstack workshop
 
Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5Moving to the Client - JavaFX and HTML5
Moving to the Client - JavaFX and HTML5
 
Server Side Javascript
Server Side JavascriptServer Side Javascript
Server Side Javascript
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Tools
 
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
IE 8 et les standards du Web - Chris Wilson - Paris Web 2008
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Net Beans61 Ide
Net Beans61 IdeNet Beans61 Ide
Net Beans61 Ide
 
GWT Training - Session 1/3
GWT Training - Session 1/3GWT Training - Session 1/3
GWT Training - Session 1/3
 
GWT training session 1
GWT training session 1GWT training session 1
GWT training session 1
 
JavaScript-Core
JavaScript-CoreJavaScript-Core
JavaScript-Core
 
JavaScript-Core
JavaScript-CoreJavaScript-Core
JavaScript-Core
 
HTML5 Introduction
HTML5 IntroductionHTML5 Introduction
HTML5 Introduction
 
How to make Ajax Libraries work for you
How to make Ajax Libraries work for youHow to make Ajax Libraries work for you
How to make Ajax Libraries work for you
 
Krishnagopal Thogiti_Java
Krishnagopal Thogiti_JavaKrishnagopal Thogiti_Java
Krishnagopal Thogiti_Java
 
Galaxy
GalaxyGalaxy
Galaxy
 

Recently uploaded

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

Internationalize Java, JavaFX, AJAX and Portlet Applications

  • 1. Learn to Internationalize your Java, JavaFX, AJAX and Portlet Applications Shankar Gowda & Shrinath Hedge Globalization Engineering Sun Microsystems, Inc.
  • 2. Agenda Globalization Overview > What's with acronyms and definitions ? > How do they differ and relate ? > Introducing Internationalization(i18n) in various technologies > Language Exercises (100 mins) > – Exercise 0: Setup Lab Environments – Exercise 1: Internationalize your Java application – Exercise 3: Internationalize AJAX Web application – Exercise 4: Internationalize Portlet application – Exercise 2: Internationalize JavaFX application > Tools, Summary and References 2
  • 3. Globalization acronyms Globalization [G1 1 n] “Globalization addresses the business issues associated with taking a product global. In the globalization of high-tech products this involves integrating localization throughout a company, after proper internationalization and product design, as well as marketing, sales, and support in the world market.” Internationalization [i1 8n] “Internationalization is the process of generalizing a product so that it can handle multiple languages and cultural conventions without the need for re-design. Internationalization takes place at the level of program design and document development.” Localization [L1 0n] “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.” Translation ===> T9n 3
  • 4. How do they differ and relate ? • Globalization at the architecture level • Internationalization ( 8n)enables Localization i1 • An expert in i1 8n may not be an expert in l1 0n • I18n (code) + l10n(linguistic) + T9n (translation) = G11n (process) 4
  • 5. Internationalization support in Java Java Platform is Internationalized ➢ Extensive library of classes and functions ● I18n support comes for free or at very little cost ● Built-in I18n support for over 70 languages ● All text in a running Java program is Unicode ➢ 5
  • 7. Example Code: Before Internationalization System.out.println(“Hello”); System.out.println(“Sun Tech Days”); System.out.println(“Hyderabad”); 7
  • 8. Example Code: After Internationalization Locale myLocale = new Locale(myLanguage, myCountry); ResourceBundle messages = ResourceBundle.getBundle(“messageBundle, myLocale); System.out.println(messages.getString(“greeting”)); System.out.println(messages.getString(“event”)); System.out.println(messages.getString(“place”)); Your Resource Bundle property catalog file will have, greeting=Hello event=Sun Tech Days place=Hyderabad 8
  • 9. Introduction to AJAX > AJAX = acronym for Asynchronous JavaScript and XML – Browser client uses JavaScript to Asynchronously – get XML data from a server and update page – dynamically without refreshing the whole page > Why is AJAX so popular ? – Increase Usability of Web Application – Save Bandwidth – Download only data you need – End user Sequence and Faster interfaces > Side effects of AJAX ? – Breaks back button support – URL's don't change as state changes – Cross Browser Issues can be a pain 9
  • 10. User Interface: Traditional Web Vs AJAX 10
  • 11. Traditional Web AJAX within a browser, there is AJAX engine 11
  • 12. AJAX Internationalization • Server Side: By setting the appropriate Request and Response Object to a right encoding in Servlet controller > In doGet method – request.setCharacterEncoding(“UTF-8”); > In sendResonse method – response.setContentType(“text/xml; charset=utf-8”); > Using Resource Bundle for externalizing messages to property files and naming them to appropriate locale variant. • Client Side: By setting your browser to UTF-8 encoding. 12
  • 13. Introducing Portlet Application > Specialized Web application that provides value-added services like, – Personalization, Single Sign-On, Content Aggregation, Dynamic Drag and Drop, Work From Desktop, Search& Tagging. > Portlet is a piece of markup called as 'Fragment' > A Portal Application can have multiple portlets. – Window functionalities like, minimize, maximize, configure, close..etc > Portal Administration for Role, Look & Feel, Permissions, SOA, JAI > Includes Wikis, Message Boards, Blogs, Email, IM, Activity Tracking, Calendar, etc.. 13
  • 15. Internationalizing your Portlet > Server Side: By setting the appropriate Resquest and Response Objects to right encoding in Servlet/JSP controller. – Adding locale support in your portlet.xml <supported-locale>hi</supported-locale> – JSP Page Directive <%page contentType=”text/html; charset=UTF-8”%> <%page pageEncoding=”UTF-8” %> – Using JSTL FMT library <% taglib uri=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt” %> – Setting Resource Bundle <fmt.setBundle basename=”PackageName.BundleName” /> – Calling the tag lib in your JSP page <fmt:message key=”name”/> > Client Side: Set your browser encoding to UTF-8. 15
  • 16. Let us start the LAB with Exercise 0 > Install Java SE 6 update 10 or above > Install NetBeans 6.5 with GlassFish V2/V3 > Copy i18nHOL.zip and unzip – Will create i18nHOL directory = <lab_root> – It contains the following: – Start with index.html – Exercises directory like 16
  • 17. Excrcise 1: Learn to Internationalize your Java Application 17
  • 18. Exercise 3: Learn to Internationalize your AJAX enabled Web Application 18
  • 19. Exercise 4: Learn to Internationalize your Portlet Application 19
  • 20. Lastly, let us take to JavaFX Lab Session 20
  • 21. JavaFX Overview JavaFX platform FX ● JavaFX Desktop ● ● JavaFX Mobile and JavaFX TV ● Other devices and screens to follow Tools Suite ● JavaFX Developer (Plug-ins for IDEs, Media ● converters, RAD tools) ● JavaFX Designer (Authoring, Video Encoding) Suite of Applications build on JavaFX ● ● JavaFX Content, Applications & Services 21
  • 22. Single Virtual Machine/ byte code 22
  • 23. JavaFX Script Programming Language Declarative, statically-typed scripting language > Facilitates rapid GUI development > Many cool, interesting language features > Runs on Virtual Machine for the Java™ platform > Deployment options same as Java programs > Fully utilizes Java class libraries behind the scenes > For content designers and Media engineers > Supports primitive types like, String, Boolean, Number, > Integer, Duration. > Supports Objects, Multiple Inheritance and any Java Objects can be used in JavaFX. 23
  • 24. Comparision of Java, Swing and JavaFX 24
  • 25. Introducing Internationalization in JavaFX > Creating a Locale Object > Setting the default locale > Create Resource Bundle property file as “Main_hi_IN.fxproperties” > Resource bundle messages are called just by prefixing with '##' > Reduces complexity! Compared to Java Resource Bundle 25
  • 26. Internationalizing Dates in JavaFX > Supports Java printf-style formats > Uses same Formatter as Java > POSIX standard strftime spec. 26
  • 27. Internationalizing of Dates in JavaFX • Formats – %tx – Locale's appropriate date representation – %tX – Locale's appropriate time representation – %tg – The last two digits of the week-based year (ISO 8601) – %tG – Week-based year (ISO 8601) – %tu – Day of week ( Monday is 1) [ 1,7 ] – %tV – ISO 8601 Week number of the Year. 27
  • 28. Looking at locale based sorting for JavaFX > Create a List of words > Create the Instance of Collator by specifying the Locale. > Define the function for Sorting and displaying the List of words. 28
  • 29. Locale based Sorting using Collator > In sort function we will call Collections.sort, that sorts the list of words in ascending order by giving the words list and strength of the collator as arguments. > Append the output to a variable. > Display as, 29
  • 30. Exercise 2: Learn to i18n JavaFXSphere • Install, Configure Lab environment • Creating a FirstJavaFXSphere Application • Internationalizing the code of FirstJavaFXSphere application • Externalizing the messages to Main_hi_IN.fxproperties • Localizing in Hindi 30
  • 31. Internationalization References Sun Software Globalization • – http://developers.sun.com/techtopics/global/ Software Globalization - Architecture, Design,Testing • – http://developers.sun.com/techtopics/global/technology/arch/ Software Globaliation- Sun Java Enterprise System • – http://developers.sun.com/techtopics/global/products_platforms/jes/ Sun Software Product Internationalization Taxonomy • – http://developers.sun.com/dev/gadc/des_dev/i18ntaxonomy Java Internationalization • – http://java.sun.com/javase/technologies/core/basic/intl/ Subscribe to Software globalization NewsLetter • – http://developers.sun.com/dev/gadc/subscribe/index.html Technical articles on Java Internationalization • – http://java.sun.com/developer/technicalArticles/Intl/ Java Internationalization Tutorial • – http://java.sun.com/docs/books/tutorial/i18n/index.html 31
  • 32. JavaFX References http://javafx.com/ • https://openjfx.dev.java.net/ • http://openjfx-compiler.dev.java.net • http://scenegraph.dev.java.net • http://java.sun.com/javafx/ • http://java.sun.com/javafx/tutorials/project_nile_integrating_graphics/ • http://openjfx.java.sun.com/current-build/doc/index.html • 32
  • 33. AJAX References The BluePrints Solutions catalog on AJAX • – https://bpcatalog.dev.java.net/nonav/solutions.html AJAX Q & A • – https://blueprints.dev.java.net/ajax-faq.html Asynchronous JavaScript Technology and XML (AJAX) with Java 2 Platform, • Enterprise Edition – http://java.sun.com/developer/technicalArticles/J2EE/AJAX/Intro_Ajax _PageAuthors.pdf AJAX Frameworks • – http://ajaxpatterns.org/wiki/index.php?title=AJAXFrameworks AJAX Library and Frameworks Comparison • – http://wiki.osafoundation.org/bin/view/Projects/AjaxLibraries AJAX Developer Resource Center • – http://developers.sun.com/ajax/ JavaScript Developer Site • – http://java.sun.com/javascript 33
  • 34. Portlet References http://javafx.com/ • https://openjfx.dev.java.net/ • http://openjfx-compiler.dev.java.net • http://scenegraph.dev.java.net • http://java.sun.com/javafx/ • http://java.sun.com/javafx/tutorials/project_nile_integrating_graphics/ • http://openjfx.java.sun.com/current-build/doc/index.html • 34
  • 35. Q&A 35
  • 36. Shankar Gowda MBN ● ● Shrinath Hedge ● 36
  • 38. JavaFX: Command Line Development include <javafx-sdk>/bin in PATH • javafxc to compile • javafx to run • Relevant library files in <javafx-sdk>/lib are • automatically included in classpath as necessary. Rest can be included with the -classpath option > With packages ● javafxc -d . firstjavafxsphere/Main.fx ● javafx firstjavafxsphere.Main > Without packages ● javafxc Main.fx ● javafx Main 38
  • 39. JavaFX: FirstJavaFXSphere.jnlp (applet) <jnlp href=quot;test.jnlpquot;> <information>... </information> <resources> <j2se version=quot;1.6+quot; href= quot;http://java.sun.com/products/autodl/j2sequot; /> <jar href=quot;FirstJavaFXSphereApplet.jarquot; main=quot;truequot; /> <jar href=quot;javafxrt.jarquot; /> <jar href=quot;javafxgui.jarquot; /> <jar href=quot;javafx-swing.jarquot; /> <jar href=quot;Scenario.jarquot; /> </resources> <applet-desc name=test main-class=quot;javafx.application.Appletquot; width=500 height=500> </applet-desc> </jnlp> 39
  • 40. JavaFX: FirstJavaFXSphere.html (Applet call) <html> <head> <title>FX Script Applet Test</title> </head> <body bgcolor=quot;#000000quot;> <h1>FX Script Applet Test</h1> <center> <applet width=quot;640quot; height=quot;480quot;> <param name=quot;jnlp_hrefquot; value=quot;FirstJavaFXSphere.jnlpquot;> <param name=quot;ApplicationClassquot; value=quot;FirstJavaFXSphereAppletquot;> </applet> </center> </body> </html> 40