Published on

Introductory presentation on Internationalization.

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Internationalization (i18n) is the process of designing an application so that it can be adapted to different languages and regions, without requiring engineering changes.Localization (l10n) is the process of adapting software for a specific region or language by adding locale-specific components and translating text.According to Apple:Internationalization is the process of designing and building an application to facilitate localization. Localization, in turn, is the cultural and linguistic adaptation of an internationalized application to two or more culturally-distinct markets.
  • You've decided that this program needs to display these same messages for people living in France and Germany. Unfortunately your programming staff is not multilingual, so you'll need help translating the messages into French and German. Since the translators aren't programmers, you'll have to move the messages out of the source code and into text files that the translators can edit. Also, the program must be flexible enough so that it can display the messages in other languages, but right now no one knows what those languages will be.It looks like the program needs to be internationalized.
  • There are several steps involved in the processCreate properties files (externalized locale-specific UI messages)Create the localeCreate a resource bundle (using the locale)Retrieve UI messages from the resource bundle
  • In the example the properties files store the translatable text of the messages to be displayed. Before the program was internationalized, the English version of this text was hardcoded in the System.out.printlnstatements. The default properties file, which is called, contains the following lines:greetings = Hello farewell = Goodbye inquiry = How are you? Now that the messages are in a properties file, they can be translated into various languages. No changes to the source code are required.
  • The French translator has created a properties file, which contains these lines:greetings = Bonjour. farewell = Au revoir. inquiry = Comment allez-vous? Notice that the values to the right side of the equal sign have been translated but that the keys on the left side have not been changed. These keys must not change, because they will be referenced when your program fetches the translated text.The name of the properties file is important. For example, the name of the file contains the fr language code and the FR country code. These codes are also used when creating a Locale object.To compile and run this program, you need these source
  • To compile and run this program, you need these source
  • To compile and run this program, you need these source
  • To compile and run this program, you need these source
  • What do you consider will require internationalization from your website ?Explain thru various examples from slides like , Text Lengths, Images, Language Direction, Fonts, Address Formats, Currency, Date Formats etcLength of text may varyIn terms of number of characters In terms of pixelsImpacts UIUnexpected text wrapsHidden / overlapping UI elementsWidth extending beyond page width / or getting croppedBitmaps & ImagesSymbolic images may at time be understood differently in different countriesSome images may have adverse political / cultural impact in some countriesImages containing text may not represent the user’s language of choice.Some images / colors may lead to legal conflicts
  • Internationalization

    1. 1. Internationalization
    2. 2. Agenda  What is Internationalization  What it offers  Sample Application  How to use it  Best Practices  Questions
    3. 3. What is Internationalization  Internationalization (i18n) the process of changing your software so that it isn't hardwired to one language/locale/culture.  Localization (l10n) the process of adding the appropriate resources to your software so that a particular language/locale is supported.
    4. 4. What is Internationalization  The terms are frequently abbreviated to the numeronyms i18n (where 18 stands for the number of letters between the first i and last n in internationalization, a usage coined at DEC in the 1970s or 80s) and L10n respectively, due to the length of the words.  Some companies, like IBM and Sun Microsystems, use the term "globalization" for the combination of internationalization and localization.  Microsoft defines Internationalization as a combination of World-Readiness and localization. World-Readiness is a developer task, which enables a product to be used with multiple scripts and cultures (globalization) and separating user interface resources in a localizable format (localizability, abbreviated to L12y).
    5. 5. What it offers  Build once, sell anywhere  Modularity demands it!  Ease of translation  “With the addition of localization data, the same executable can be run worldwide.”
    6. 6. Characteristics  Textual elements such as status messages and the GUI component labels are not hardcoded in the program. Instead, they are stored outside the source code and retrieved dynamically.  Support for new languages does not require recompilation.  Other culturally-dependent data, such as dates and currencies, appear in formats that conform to the end-user's region and language.
    7. 7. Sample Application  Before Internationalization  After Internationalization
    8. 8. Before Internationalization
    9. 9. After Internationalization % java I18NSample fr FR Bonjour. Comment allez-vous? Au revoir. % java I18NSample en US Hello. How are you? Goodbye.
    10. 10. How does it work 1) Create Properties Files 2) Define the Locale 3) Create Resource Bundle 4) Fetch Text from Resource Bundle
    11. 11. Properties file  A properties file stores information about the characteristics of a program or environment. A properties file is in plain-text format.  E.g. greetings = Hello farewell = Goodbye inquiry = How are you?
    12. 12. Locale  The Locale object identifies a particular language     and country. has the form xx_YY xx is two-character language code (ISO-639) YY is two-character country code (ISO-3166) Examples:  en_US - United States English  en_GB - Great Britain English  es_MX - Mexico Spanish (Espanol)
    13. 13. 1) Create Properties file  greetings = Bonjour. farewell = Au revoir. inquiry = Comment allez-vous?  Keys remains same, values changes
    14. 14. 2) Define the locale
    15. 15. 3) Create a ResourceBundle
    16. 16. 4) Fetch Text from ResourceBundle
    17. 17. What may need Internationalization  Just a few thing  And some more  messages • numbers  labels on GUI • currencies        components online help sounds colors graphics icons dates times • measurements • phone numbers • honorifics and personal titles • postal addresses • page layouts
    18. 18. What’s easily translatable?  Status messages  Error messages  Log file entries  GUI component labels  BAD! Button okButton = new Button(“OK”);  GOOD! String okLabel = ButtonLabel.getString("OkKey"); Button okButton = new Button(okLabel);
    19. 19. What’s NOT (easily translatable)?  “At 1:15 PM on April 13, 1998, we attack the 7 ships on Mars.” template = At {2,time,short} on {2,date,long}, we attack the {1,number,integer} ships on planet {0}. planet = Mars The time portion of a Date object. The "short" style specifies the DateFormat.SHORT formatting style. The date portion of a Date object. The same Date object is used for both the date and time variables. In the Object array of arguments the index of the element holding the Date object is 2. A Number object, further qualified with the "integer" number style. The String in the ResourceBundle that corresponds to the "planet" key.
    20. 20. 1. Compound Messages: messageArguments...  Set the message arguments…  Remember the numbers in the template refer to the index in messageArguments!
    21. 21. 2. Compound Messages: create formatter...  Don’t forget setting the Locale of the formatter object...
    22. 22. 3. Compound Messages:  Get the template we defined earlier…  Then pass in our arguments!  And finally RUN...
    23. 23. Sample Run… currentLocale = en_US At 1:15 PM on April 13, 1998, we attack the 7 ships on the planet Mars. currentLocale = de_DE Um 13.15 Uhr am 13. April 1998 haben wir 7 Raumschiffe auf dem Planeten Mars entdeckt.
    24. 24. What’s NOT (easily translatable)?  Plurals! There There There are no files is one file are 2 files on XDisk. on XDisk. on XDisk. Also variable... 3 possibilities for output templates. Possible integer value in one of the templates.
    25. 25. Plurals pattern = There {0} on {1}. noFiles = are no files oneFile = is one file multipleFiles = are {2} files noFiles = are no files oneFile = is one file multipleFiles = are {2} files There are 2 files on XDisk.
    26. 26. Plurals  What’s different?  Now we even index our templates… see fileStrings, indexe d with fileLimits.  First create the array of templates.
    27. 27. Sample Run currentLocale = en_US There There There There are no files on XDisk. is one file on XDisk. are 2 files on XDisk. are 3 files on XDisk. currentLocale = fr_FR Il Il Il Il n' y a pas des y a un fichier y a 2 fichiers y a 3 fichiers fichiers sur XDisk. sur XDisk. sur XDisk. sur XDisk.
    28. 28. Numbers  Supported through NumberFormat! o Shows what locales are available. Note, you can also Locale[] create custom formats if needed. locales = NumberFormat.getAvailableLocales(); 345 987,246 345.987,246 345,987.246 fr_FR de_DE en_US
    29. 29. Currency  Supported with: NumberFormat.getCurrencyInstance! 9 876 543,21 F fr_FR 9.876.543,21 DM de_DE $9,876,543.21 en_US
    30. 30. A Date and Time  Supported with:  DateFormat.getDateInstance DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.DEFAULT, currentLocale);  DateFormat.getTimeInstance DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, currentLocale);  DateFormat.getDateTimeInstance DateFormat dateTimeFormatter = DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.LONG, currentLocale);
    31. 31. Date example  Supported with: DateFormat.getDateInstance 9 avr 98 9.4.1998 09-Apr-98 fr_FR de_DE en_US
    32. 32. Unicode Characters  16 bit!  65,536 characters  Encodes all major languages  In Java Char is a Unicode character  See Future Use ASCII 0x0000 Greek Kana Symbols Internal 0xFFFF
    33. 33. Java support for the Unicode Char  Character API:        isDigit isLetter isLetterOrDigit isLowerCase isUpperCase isSpaceChar isDefined  Unicode Char values accessed with: String eWithCircumflex = new String("u00EA");
    34. 34. Java support for the Unicode Char  Example of some repair…  BAD! if ((ch  GOOD!>= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) // ch is a letter if (Character.isLetter(ch)) // ch is a letter
    35. 35. Java support for the Unicode Char  Get the Unicode category for a Char:      LOWERCASE_LETTER UPPERCASE_LETTER MATH_SYMBOL CONNECTOR_PUNCTUATION etc... if (Character.getType('_') == Character.CONNECTOR_PUNCTUATION) // ch is a “connector”
    36. 36. Next Steps - Internationalization  Expedite and make necessary business decisions  Identify the scope and timelines for internationalization  Implement design and code changes
    37. 37. Localization  Identify the specific localization need  Country / Culture  Language(s) to be supported  Pages / Interfaces / data elements to be localized  Translation  Language experts for translation  Localize content (text, graphics, etc)  Build a translation database, if required  Implement design & code changes that may arise
    38. 38. Questions
    39. 39. Thank you ..
    40. 40. References:  tml    ase/Showcase.html