session 5 - inter nationalization and network

Upload: le-duc-anh-toi

Post on 06-Apr-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    1/29

    Session 5

    Internationalization

    Networking

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    2/29

    Slide 2/29

    Introduction to advance swing control

    JColorChooser

    JList

    JComboBox

    JTable

    JTree

    JTabbedPane JSplitPane

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    3/29

    Slide 3/29

    Module 1 Introduction to Internationalization

    Internationalization Process

    Internationalization Elements

    Module 2 Overivew of Networking

    URL

    URLConnection class

    Socket class,ServerSocket class

    Datagram

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    4/29

    Slide 4/29

    Need of Internationalization Not all countries across the world speak or understand English

    language

    Symbols for currency vary across countries

    Date and Time are represented differently in some countries

    Spelling also varies amongst some countries

    Alternatives to Solve the Problem

    Develop the entire product in the desired language

    Translate the entire product in the desired language

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    5/29

    Slide 5/29

    The process of creating applications which can adapt andadjust to various countries, languages and regions is knownas internationalization. The word internationalization is

    often abbreviated as I18N. The process of adapting an application for a specific

    language or country by addition of locale-specificcomponents and translation of text is referred to aslocalization. The word localization is often abbreviated as

    L10N.

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    6/29

    Slide 6/29

    The same executable application can run worldwide

    Textual elements such as labels and messages for GUI are

    not hard-code.

    Support for new language does not require recompilation

    Culturally dependent data, such as date and currency appear

    formats that conform.

    Internationalized programs are localized quickly

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    7/29

    Slide 7/29

    Unicode provides a unique number for every characterirrespective of platform, program or language. Unicode is a 16-

    bit character encoding system that supports the worlds major

    languages. The primitive data type char in Java is based on

    Unicode encoding.

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    8/29

    Slide 8/29

    1. Creating the Properties File

    2. Defining the Locale

    1. Locale(String language, String country)2. Locale(String language)

    3. Using the ResourceBundle class

    4. Fetching the Text from Resource Bundle

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    9/29

    Slide 9/29

    Numbers: The NumberFormat class is used to create locale-specific

    formats for

    Numbers

    Currencies

    Percentages

    Methods

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    10/29

    Slide 10/29

    Date and Time: The date and time format should conform tothe conventions of the end users locale.

    The method below is used to get the DateFormat:

    getDateInstance(style, locale)

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    11/29

    Slide 11/29

    Overivew of Networking

    URL

    URLConnection class

    Socket class

    ServerSocket class

    Datagram

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    12/29

    Slide 12/29

    TCP(Transmission Control Protocol) a connection-based

    protocol that provides a reliable flow of data between two

    computers

    TCP is based on a four-layered model

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    13/29

    Slide 13/29

    A computer generally has a single physical connectionavailable for the network. The physical connections are thetwo serial ports COM1 and COM2. One of these is usuallyused by a pointing device like the mouse. That leaves only asingle physical connection for the network.

    There are some application uses same a port physical, Hencedata being send and received on the physical connection areon the concept of logic ports

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    14/29

    Slide 14/29

    The physical connection is logically numbered within arange of 0 to 65535. The port numbers ranging from 0 to

    1023 are reserved

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    15/29

    Slide 15/29

    URL is an acronym for Uniform Resource Locator. It is areference or an address to a resource on the internet.

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    16/29

    Slide 16/29

    Thejava.netpackage has a class URL which can be used toconstruct an URL object.

    Constructors

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    17/29

    Slide 17/29

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    18/29

    Slide 18/29

    This class is used to create an IP address. An IP address iseither a 32 bit or 128 bit unsigned number used by IP which

    is a low level protocol

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    19/29

    Slide 19/29

    URLConnection is an abstract class that represents the

    communication like beetween an application and a URL.

    The URL class has a method openConnection to create an

    URLConnection instance.

    Some common methods

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    20/29

    Slide 20/29

    A socket is one end-point of a two-way communication like between two programs

    running on the networking

    A server application runs on a machine and has a socket bound to a port. The server

    wait, listening to a client socket to make a connection request.

    On the client-side need to known the host name of the machine on the server is

    running and the port to make a connection request. The client opens a socket with the

    server on the servers machine and port

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    21/29

    Slide 21/29

    The java.net.Socket class is used to represent the connectionbetween a client program and a server program.

    Constructor

    Socket(String hots, int port)

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    22/29

    Slide 22/29

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    23/29

    Slide 23/29

    The ServerSocket class is used to represent the server side of the two-way

    communication.

    Constructor

    ServerSocket(int port) throws IOException

    Creating ServerSocket Instance

    Demo

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    24/29

    Slide 24/29

    A datagram is an independent, self-contained message sentover the network whose arrival, arrival time, and order ofcontent are not guaranteed

    Datagram packets are used to employ a connectionless

    packet delivery service. Each message is routed based solelyon information contained within that packet.Multiplepackets sent from one machine to another might routeddifferently. Packets delivery by datagrams are notguaranteed.

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    25/29

    Slide 25/29

    The java.net package provides the DatagramPacket class tocreate a datagram pakcet.

    Constructors

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    26/29

    Slide 26/29

    DatagramSocket class represents a socket for sending andreceiving datagram packet.

    Constructor

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    27/29

    Slide 27/29

    send(DataPacket p)

    receive(DataPacket p)

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    28/29

    Slide 28/29

  • 8/3/2019 Session 5 - Inter Nationalization and Network

    29/29

    Slide 29/29

    Introduction to I18N and L10N

    Why need I18N and L10N?

    How to implements?

    Components of I18N and L10N Networking

    Concept of Socket

    Using of Socket Datagram and using Datagram