Fuchsia uses the ICU library for the commonly shared internationalization services such as date, time, timezone, locale and language handling.
The ICU library consists roughly of two different parts: the ICU library code which contains the ICU algorithms, and the ICU library data, which contains locale-specific information that is packaged for independent reuse.
The code is available through appropriate shared libraries in
//third_party/icu (see below).
In Fuchsia, the ICU data is made available to be loaded at runtime. Please see the ICU data use instructions on how to load this data.
BUILD.gn rules need changing
icu_data needs the ICU data files to be made available in the Fuchsia
package, please see ICU data use instructions for an exaple of
how to make the data files available.
Using the ICU library
This section assumes that you have read and followed the instructions from the Prerequisites section in full detail.
C and C++
The ICU library is imported through a third-party dependency
//third_party/icu. As an example use of the library, one can look at the C++
wisdom example. This is a sample client-server collaboration that
requests, serves and prints on screen date and time information using several
different languages, calendars and scripts.
The ICU library is available in rust programs as well, through a binding of the ICU4C library into Rust.
The library is subdivided into several crates, each one corresponding to a specific part of the ICU4C headers, and named after the corresponding one. Today, the functionality is partial, and is constructed to serve Fuchsia's Unicode needs.
As a demonstration of the rust bindings for ICU4C, we made a rust equivalent of the wisdom server. This example is available as the rust wisdom example.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-11-22.