Download presentation
Presentation is loading. Please wait.
Published byAlejandro West Modified over 10 years ago
1
Draft Java/ICU Internationalization Architecture Mark Davis
2
Summary: Java / ICU Shared basic architecture –Locales, resources, services, data-driven –Same development team: Java and C/C++ –Core ICU4j part of Java 1.1 and later –API syntax customized to programming language Cross-platform Fully extensible Thread-safe model Open Source: ICU4j, ICU4c
3
Locales Name, not data structure Language, Country, Variant –English –English, US –Norwegian, Norway, Nynorsk –Italy, Italian, Euro
4
Resources General Purpose: map Key Data –Application-Specific Data –General Services Data String String Array:recurse Key Data:recurse Java: arbitrary Objects as well
5
Resources Inheritance Find Resource en_us_some-variant en_us en defLang_defCountry defLang root Results cached Find Bundle
6
Data Flexible loading structure Memory mapped files DLLs Simple loading
7
Services Locale-Independent –Unicode characters: storage / access, properties –Character conversion Locale or ID-Dependent Explicit or Default Locale –Format/parse: number/currency/date-time/msgs,… –Language-sensitive collation, searching,… –Boundaries: character, word, line-wrap, sentence –Display names: country / language –Transliteration, casing
8
Open, Use, Close Java col = Collator.getInstance ( aLocale ); … sortKey = col.getSortKey ( aStr ); ICU4c col = ucol_open( aLocale, &err); … keyLen = ucol_getSortKey ( col, aStr, -1, sortKey, maxLen ); … ucol_close ( col );
9
Why Open/Close? –Amortize setup over multiple uses With convenience routines for one-time or simple use –Full Multi-locale, Multi-thread Example: Open sortFrance and sortUS Use at same time, in same thread or different threads Constant data shared between threads –Note: Different threads need different opens
10
Threading Common read- only data French Common read- only data German Thread 1Thread 2 Collator State Ptr Collator State Ptr Collator State Ptr
11
Error Handling Java –Exceptions C / C++ –Local error parameter: &err –Supports chaining –Minimal compiler demands
12
Data Driven Wherever possible, services are data-driven. Examples –Collations: z < þ or И < Й –Numbers: #,##0.00 –Transliterations: a <> α or ps <> ψ Services: built at compile time or runtime Services: built by merging –E.g. French + Arabic sorting
13
Data Storage Format Java –Class files (compiled) –Property files (processed at runtime) ICU4c –Precompiled DLLs or Memory-mapped file –Flattened structure: memory structure = disk –Collation ICU4c 1.7
14
Character Conversions List supported names, aliases Low-level buffer support We handle details no copying parts
15
Summary: Java / ICU Shared basic architecture –Locales, resources, services, data-driven –Same development team: Java and C/C++ –Core ICU4j part of Java 1.1 and later –API syntax customized to programming language Cross-platform Fully extensible Thread-safe Open Source: ICU4j, ICU4c
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.