SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash CourseWill Iverson
 
Internationalization in Java
Internationalization in JavaInternationalization in Java
Internationalization in Javaachraf_ing
 
GNU Internationalization Presentation
GNU Internationalization PresentationGNU Internationalization Presentation
GNU Internationalization PresentationJoe Turner
 
Simple 20 Minute Code Review
Simple 20 Minute Code ReviewSimple 20 Minute Code Review
Simple 20 Minute Code ReviewJoe Turner
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)Hendrik Ebbers
 
Anatomia pelvica y pelvimetria
Anatomia pelvica y pelvimetriaAnatomia pelvica y pelvimetria
Anatomia pelvica y pelvimetriaJuan Carlos Vaquen
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014Ryan Cuprak
 
Extended definitions
Extended definitionsExtended definitions
Extended definitionsJoe Turner
 

Destaque (9)

Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash Course
 
Internationalization in Java
Internationalization in JavaInternationalization in Java
Internationalization in Java
 
GNU Internationalization Presentation
GNU Internationalization PresentationGNU Internationalization Presentation
GNU Internationalization Presentation
 
DataFX - JavaOne 2013
DataFX - JavaOne 2013DataFX - JavaOne 2013
DataFX - JavaOne 2013
 
Simple 20 Minute Code Review
Simple 20 Minute Code ReviewSimple 20 Minute Code Review
Simple 20 Minute Code Review
 
DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)DataFX 8 (JavaOne 2014)
DataFX 8 (JavaOne 2014)
 
Anatomia pelvica y pelvimetria
Anatomia pelvica y pelvimetriaAnatomia pelvica y pelvimetria
Anatomia pelvica y pelvimetria
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014
 
Extended definitions
Extended definitionsExtended definitions
Extended definitions
 

Semelhante a 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
 

Semelhante a 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
 

Último

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Último (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

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