1 / 15

Java/ICU Internationalization Architecture

Java/ICU Internationalization Architecture. Mark Davis. 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

riva
Download Presentation

Java/ICU Internationalization Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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: recurseKey  Data: recurse • Java: arbitrary Objects as well

  5. Find Bundle Resources Inheritance • Find Resource en_us_some-varianten_usendefLang_defCountrydefLangroot • Results cached

  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 sortFranceandsortUS • Use at same time, in same thread or different threads • Constant data shared between threads • Note: Different threads need different “opens”

  10. Thread 1 Thread 2 Collator State Ptr Collator State Ptr Collator State Ptr Common read-only data German Common read-only data French Threading

  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

More Related