blob: d05f155b0c96c4c8cf914faf96f430bd07036c39 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.intl;
/// Typed identifier for a single Locale, which is a set of internationalization-related properties.
///
/// Most APIs that consume locales will probably want to accept a vector of locales to account for
/// priority.
struct LocaleId {
/// Unicode BCP-47 Locale Identifier
/// (http://www.unicode.org/reports/tr35/#BCP_47_Conformance).
///
/// Must be canonicalized and well-formed. This field should not be populated from arbitrary
/// user- or third-party input, but instead generated programmatically.
///
/// Includes language, region, script, and variant, plus Unicode extensions (under the "u"
/// singleton). Other extensions are allowed but ignored.
///
/// Examples:
/// "en-US"
/// American English
/// "fr-u-hc-h12"
/// French, with 12-hour clock
/// "ar-EG-u-fw-mon-nu-latn"
/// Egyptian Arabic with "Latin" numerals and first day of week on Monday
string id;
};
/// Typed identifier for a single calendar system. Currently consists only of a calendar ID.
struct CalendarId {
/// Unicode BCP-47 Locale Identifier with an undefined language tag and a single extension
/// specifying the calendar ID (from
/// https://unicode.org/repos/cldr/trunk/common/bcp47/calendar.xml).
///
/// Examples:
/// "und-u-ca-gregory"
/// "und-u-ca-islamic"
string id;
};
/// Typed identifier for a time zone.
struct TimeZoneId {
/// Time zone ID from tzdata, e.g. "America/New_York". See https://www.iana.org/time-zones.
string id;
};
/// Selection of temperature unit.
enum TemperatureUnit {
CELSIUS = 0;
FAHRENHEIT = 1;
};
/// A collection of ranked internationalization properties.
///
/// There is no implied origin for this information; it might come from a user account, device
/// settings, a synthesis of user settings and app-specific overrides, or anywhere else.
///
/// Language-independent properties that are supported by Unicode BCP-47 Locale IDs (e.g.
/// first-day-of-week, time zone) are denormalized into the locale IDs in |locales|.
table Profile {
/// Ranked list of locales (in descending order).
1: vector<LocaleId> locales;
/// Ranked list of calendars (in descending order). The first entry is the primary calendar, and
/// will be equal to the calendar indicated in |locales|.
/// The list is intended for use by applications that can display multiple calendar systems.
2: vector<CalendarId> calendars;
/// Ranked list of time zones (in descending order). The first entry is the primary time zone,
//// which should be used by default for formatting dates and times; it will be equal to the
/// calendar indicated in |locales|.
/// The list is intended for use by applications that can display multiple time zones, e.g.
/// a world clock.
3: vector<TimeZoneId> time_zones;
/// Selected temperature unit.
4: TemperatureUnit temperature_unit;
// TODO(CF-168): Other properties that don't fit into locale IDs. Examples:
// - User date format overrides, like d/mmm/y
// - User currency overrides
// - User number overrides (grouping, decimal point)
};