SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Internationalization
Agenda
 What is Internationalization
 What it offers
 Sample Application
 How to use it
 Best Practices

 Questions
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.
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).
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.”
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.
Sample Application
 Before Internationalization
 After Internationalization
Before Internationalization
After Internationalization
% java I18NSample fr FR
Bonjour.
Comment allez-vous?
Au revoir.

% java I18NSample en US
Hello.
How are you?
Goodbye.
How does it work
1) Create Properties Files
2) Define the Locale
3) Create Resource Bundle
4) Fetch Text from Resource Bundle
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?
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)
1) Create Properties file
 MessagesBundle_fr_FR.properties
greetings = Bonjour.
farewell = Au revoir.
inquiry = Comment allez-vous?

 Keys remains same, values changes
2) Define the locale
3) Create a ResourceBundle
4) Fetch Text from
ResourceBundle
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
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);
What’s NOT (easily translatable)?


“At 1:15 PM on April 13, 1998, we attack the 7 ships on Mars.”

MessageBundle_en_US.properties
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.
1. Compound Messages:
messageArguments...
 Set the message

arguments…
 Remember the

numbers in the
template refer to the
index in
messageArguments!
2. Compound Messages:
create formatter...
 Don’t forget setting

the Locale of the
formatter object...
3. Compound Messages:

 Get the template we

defined earlier…
 Then pass in our

arguments!
 And finally RUN...
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.
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.
Plurals
ChoiceBundle_en_US.properties
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.
Plurals
 What’s different?
 Now we even

index our
templates… see
fileStrings, indexe
d with fileLimits.
 First create the

array of templates.
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.
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
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
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);
Date example
 Supported with: DateFormat.getDateInstance

9 avr 98
9.4.1998
09-Apr-98

fr_FR
de_DE
en_US
Unicode Characters
 16 bit!
 65,536 characters
 Encodes all major languages
 In Java Char is a Unicode character
 See unicode.org/

Future Use
ASCII

0x0000

Greek

Kana
Symbols

Internal

0xFFFF
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");
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
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”
Next Steps - Internationalization
 Expedite and make necessary business decisions
 Identify the scope and timelines for

internationalization
 Implement design and code changes
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
Questions
Thank you ..
References:
 http://docs.oracle.com/javase/tutorial/i18n/index.h

tml
 https://www.slideshare.net
 https://www.google.com
 http://gwt.googleusercontent.com/samples/Showc
ase/Showcase.html

Weitere ähnliche Inhalte

Was ist angesagt?

Presentation On Android
Presentation On AndroidPresentation On Android
Presentation On Android
TeachMission
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
salmankhan570
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
Vasavi College of Engg
 

Was ist angesagt? (20)

Computer Virus powerpoint presentation
Computer Virus powerpoint presentationComputer Virus powerpoint presentation
Computer Virus powerpoint presentation
 
Web browsers
Web browsersWeb browsers
Web browsers
 
Computer Science & Information Systems
Computer Science & Information SystemsComputer Science & Information Systems
Computer Science & Information Systems
 
Operating system
Operating systemOperating system
Operating system
 
Compilers
CompilersCompilers
Compilers
 
Types of Compilers
Types of CompilersTypes of Compilers
Types of Compilers
 
Os ppt
Os pptOs ppt
Os ppt
 
Presentation On Android
Presentation On AndroidPresentation On Android
Presentation On Android
 
Synopsis on android application
Synopsis on android applicationSynopsis on android application
Synopsis on android application
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating system
 
Introduction to Distributed System
Introduction to Distributed SystemIntroduction to Distributed System
Introduction to Distributed System
 
Native Apps vs. Web Apps – What Is the Better Choice?
Native Apps vs. Web Apps – What Is the Better Choice?Native Apps vs. Web Apps – What Is the Better Choice?
Native Apps vs. Web Apps – What Is the Better Choice?
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Language processors
Language processorsLanguage processors
Language processors
 
Building Block Diagram of Computer | Process of CPU | Input unit | Processing...
Building Block Diagram of Computer | Process of CPU | Input unit | Processing...Building Block Diagram of Computer | Process of CPU | Input unit | Processing...
Building Block Diagram of Computer | Process of CPU | Input unit | Processing...
 
Deployment Models of Cloud Computing.pptx
Deployment Models of Cloud Computing.pptxDeployment Models of Cloud Computing.pptx
Deployment Models of Cloud Computing.pptx
 
Anti virus
Anti virusAnti virus
Anti virus
 
Graphical User Interface
Graphical User Interface Graphical User Interface
Graphical User Interface
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 

Andere mochten auch

Vacation Planner
Vacation PlannerVacation Planner
Vacation Planner
ashkamodi
 
Honorary Degree Leaflet
Honorary Degree LeafletHonorary Degree Leaflet
Honorary Degree Leaflet
Shirley
 
Lingkungan presentation - liz
Lingkungan presentation - lizLingkungan presentation - liz
Lingkungan presentation - liz
liz
 
What's Hot On Facebook - 19/10/2011
What's Hot On Facebook - 19/10/2011What's Hot On Facebook - 19/10/2011
What's Hot On Facebook - 19/10/2011
David Nattriss
 
Skf q4 2010_pr_eng
Skf q4 2010_pr_engSkf q4 2010_pr_eng
Skf q4 2010_pr_eng
SKF
 

Andere mochten auch (20)

Lua 30+ Programming Skills and 20+ Optimization Tips
Lua 30+ Programming Skills and 20+ Optimization TipsLua 30+ Programming Skills and 20+ Optimization Tips
Lua 30+ Programming Skills and 20+ Optimization Tips
 
Vacation Planner
Vacation PlannerVacation Planner
Vacation Planner
 
Honorary Degree Leaflet
Honorary Degree LeafletHonorary Degree Leaflet
Honorary Degree Leaflet
 
Lingkungan presentation - liz
Lingkungan presentation - lizLingkungan presentation - liz
Lingkungan presentation - liz
 
Progressive Movement
Progressive MovementProgressive Movement
Progressive Movement
 
Career Development 101
Career Development 101Career Development 101
Career Development 101
 
Samri Ki Jawala
Samri Ki JawalaSamri Ki Jawala
Samri Ki Jawala
 
Genitori code week 2016
Genitori code week 2016 Genitori code week 2016
Genitori code week 2016
 
Visual I Solutions
Visual I SolutionsVisual I Solutions
Visual I Solutions
 
Dontjustchangeengine
DontjustchangeengineDontjustchangeengine
Dontjustchangeengine
 
Telstra\'s Climate Change Opportunities Report
Telstra\'s Climate Change Opportunities ReportTelstra\'s Climate Change Opportunities Report
Telstra\'s Climate Change Opportunities Report
 
galeria wolontariatu
galeria wolontariatugaleria wolontariatu
galeria wolontariatu
 
Designing Special Feature Pages
Designing Special Feature PagesDesigning Special Feature Pages
Designing Special Feature Pages
 
Sonder groupintromay2011
Sonder groupintromay2011Sonder groupintromay2011
Sonder groupintromay2011
 
What's Hot On Facebook - 19/10/2011
What's Hot On Facebook - 19/10/2011What's Hot On Facebook - 19/10/2011
What's Hot On Facebook - 19/10/2011
 
People of Durban
People of DurbanPeople of Durban
People of Durban
 
Skf q4 2010_pr_eng
Skf q4 2010_pr_engSkf q4 2010_pr_eng
Skf q4 2010_pr_eng
 
Datta Nadkarni portfolio 2014- Marketing Strategist for- Farmers, LensCrafter...
Datta Nadkarni portfolio 2014- Marketing Strategist for- Farmers, LensCrafter...Datta Nadkarni portfolio 2014- Marketing Strategist for- Farmers, LensCrafter...
Datta Nadkarni portfolio 2014- Marketing Strategist for- Farmers, LensCrafter...
 
Twitter
TwitterTwitter
Twitter
 
Presentatie Ps Verkort Klant
Presentatie Ps Verkort KlantPresentatie Ps Verkort Klant
Presentatie Ps Verkort Klant
 

Ähnlich wie Internationalization

Internationlization
InternationlizationInternationlization
Internationlization
Tuan Ngo
 
Case Summary Assignment Planning and organization fundamentally .docx
Case Summary Assignment Planning and organization fundamentally .docxCase Summary Assignment Planning and organization fundamentally .docx
Case Summary Assignment Planning and organization fundamentally .docx
troutmanboris
 

Ähnlich wie Internationalization (20)

Internationlization
InternationlizationInternationlization
Internationlization
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
 
GNU Internationalization Presentation
GNU Internationalization PresentationGNU Internationalization Presentation
GNU Internationalization Presentation
 
Avoiding Pitfalls with Internationalization & Localization
Avoiding Pitfalls with Internationalization & LocalizationAvoiding Pitfalls with Internationalization & Localization
Avoiding Pitfalls with Internationalization & Localization
 
Multi Lingual Websites In Umbraco
Multi Lingual Websites In UmbracoMulti Lingual Websites In Umbraco
Multi Lingual Websites In Umbraco
 
Technical Interview
Technical InterviewTechnical Interview
Technical Interview
 
Filehandlinging cp2
Filehandlinging cp2Filehandlinging cp2
Filehandlinging cp2
 
Localization and Shared Preferences in android
Localization and Shared Preferences in androidLocalization and Shared Preferences in android
Localization and Shared Preferences in android
 
Lecture10
Lecture10Lecture10
Lecture10
 
Python unit1
Python unit1Python unit1
Python unit1
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
 
Files
FilesFiles
Files
 
Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...Code as Data workshop: Using source{d} Engine to extract insights from git re...
Code as Data workshop: Using source{d} Engine to extract insights from git re...
 
VB Dot net
VB Dot net VB Dot net
VB Dot net
 
Case Summary Assignment Planning and organization fundamentally .docx
Case Summary Assignment Planning and organization fundamentally .docxCase Summary Assignment Planning and organization fundamentally .docx
Case Summary Assignment Planning and organization fundamentally .docx
 
Software Internationalization Crash Course
Software Internationalization Crash CourseSoftware Internationalization Crash Course
Software Internationalization Crash Course
 
FIT XXth World Congress in Berlin - SDL Tools Workshop
FIT XXth World Congress in Berlin - SDL Tools WorkshopFIT XXth World Congress in Berlin - SDL Tools Workshop
FIT XXth World Congress in Berlin - SDL Tools Workshop
 
Python interview questions and answers
Python interview questions and answersPython interview questions and answers
Python interview questions and answers
 
Python Interview questions 2020
Python Interview questions 2020Python Interview questions 2020
Python Interview questions 2020
 
Python interview questions
Python interview questionsPython interview questions
Python interview questions
 

Kürzlich hochgeladen

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Kürzlich hochgeladen (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

Internationalization

  • 2. Agenda  What is Internationalization  What it offers  Sample Application  How to use it  Best Practices  Questions
  • 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. 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. 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. 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. Sample Application  Before Internationalization  After Internationalization
  • 9. After Internationalization % java I18NSample fr FR Bonjour. Comment allez-vous? Au revoir. % java I18NSample en US Hello. How are you? Goodbye.
  • 10. How does it work 1) Create Properties Files 2) Define the Locale 3) Create Resource Bundle 4) Fetch Text from Resource Bundle
  • 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. 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. 1) Create Properties file  MessagesBundle_fr_FR.properties greetings = Bonjour. farewell = Au revoir. inquiry = Comment allez-vous?  Keys remains same, values changes
  • 14. 2) Define the locale
  • 15. 3) Create a ResourceBundle
  • 16. 4) Fetch Text from ResourceBundle
  • 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. 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. What’s NOT (easily translatable)?  “At 1:15 PM on April 13, 1998, we attack the 7 ships on Mars.” MessageBundle_en_US.properties 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. 1. Compound Messages: messageArguments...  Set the message arguments…  Remember the numbers in the template refer to the index in messageArguments!
  • 21. 2. Compound Messages: create formatter...  Don’t forget setting the Locale of the formatter object...
  • 22. 3. Compound Messages:  Get the template we defined earlier…  Then pass in our arguments!  And finally RUN...
  • 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. 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. Plurals ChoiceBundle_en_US.properties 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. Plurals  What’s different?  Now we even index our templates… see fileStrings, indexe d with fileLimits.  First create the array of templates.
  • 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. 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. 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. 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. Date example  Supported with: DateFormat.getDateInstance 9 avr 98 9.4.1998 09-Apr-98 fr_FR de_DE en_US
  • 32. Unicode Characters  16 bit!  65,536 characters  Encodes all major languages  In Java Char is a Unicode character  See unicode.org/ Future Use ASCII 0x0000 Greek Kana Symbols Internal 0xFFFF
  • 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. 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. 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. Next Steps - Internationalization  Expedite and make necessary business decisions  Identify the scope and timelines for internationalization  Implement design and code changes
  • 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
  • 40. References:  http://docs.oracle.com/javase/tutorial/i18n/index.h tml  https://www.slideshare.net  https://www.google.com  http://gwt.googleusercontent.com/samples/Showc ase/Showcase.html

Hinweis der Redaktion

  1. 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.
  2. You&apos;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&apos;ll need help translating the messages into French and German. Since the translators aren&apos;t programmers, you&apos;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.
  3. 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
  4. 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 MessagesBundle.properties, 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.
  5. The French translator has created a properties file calledMessagesBundle_fr_FR.properties, 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 MessagesBundle_fr_FR.properties 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 files:I18NSample.javaMessagesBundle.propertiesMessagesBundle_de_DE.propertiesMessagesBundle_en_US.propertiesMessagesBundle_fr_FR.properties
  6. To compile and run this program, you need these source files:I18NSample.javaMessagesBundle.propertiesMessagesBundle_de_DE.propertiesMessagesBundle_en_US.propertiesMessagesBundle_fr_FR.properties
  7. To compile and run this program, you need these source files:I18NSample.javaMessagesBundle.propertiesMessagesBundle_de_DE.propertiesMessagesBundle_en_US.propertiesMessagesBundle_fr_FR.properties
  8. To compile and run this program, you need these source files:I18NSample.javaMessagesBundle.propertiesMessagesBundle_de_DE.propertiesMessagesBundle_en_US.propertiesMessagesBundle_fr_FR.properties
  9. 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 &amp; 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