Locale Open Service Interface Definitions locale version 3.0.0
The Locale OSID provides the service of localizing applications defining interfaces for string translation, measurement unit conversion, calendar conversion, spatial conversion, and currency conversion.
String Translation
The Locale OSID can access and manage string translations using the
TranslationSession
and TranslationAdminSession
respectively.
Translations map a pair of strings with language and script Types. The
translation services provide a simple means for an OSID Consumer to
localize known display strings for an application.
Numeric Formatting
The NumericFormattingSession
provides the service of converting
numbers to display strings and parsing display strings into numbers. The
format of the display string is identified by a numeric format Type
.
It supports the various numeric types defined among OSID Primitives such
as integers, decimals, and cardinal numbers.
Calendar Formatting
The CalendarFormattingSession
converts DateTime
and Time
OSID Primitives to display strings and parses display strings back into
DateTimes
and Times
. The display string formats are specified by
a date format Type
and time format Type
respectively. The
calendaring and time systems implemented by DateTime
and Time
are specified by a calendar Type
and time Type
. Conversions
among calendaring systems are performed using the
CalendarConversionSession
.
Currency Formatting
The CurrencyFormattingSession
converts currency amounts to display
strings and parses display strings into currency amounts. The format of
the display string is identified by both a currency and a numeric format
Type
. Conversions among currencies are performed using the
CurrencyConversionSession
.
Coordinate Formatting
The CoordinateFormattingSession
converts Coordinate
OSID
Primitives to display strings and parses display strings back into
Coordinates
. The display string formats are specified by a
coordinate format Type
. The coordinate data is identified by the
coordinate record Type
. Conversions among calendaring systems are
performed using the CoordinateConversionSession
.
Unit Conversion
The UnitConversionSession
converts units of measurement among unit
types. The unit types may represent different units within the same
system of measurement or units among different measurement systems where
a conversion exists.
Currency Conversion
The CurrencyConversionSession
converts a currency amount from one
currency system to another where a means for transforming the currency
values exists.
Spatial Unit Conversion
The SpatialUnitConversionSession
converts a spatial units from one
spatial system to another where a means for transforming the spatial
units exists.
Text Format Conversion
The FormatConversionSession
converts text from one format to
another.
Informational Objects
The Locale OSID includes a CalendarInfo
and TimeInfo
interfaces
for inspecting the details of the respective Types
to assist in
displaying calendars and clocks without knowledge of the specific
system.
The Locale
interface defines a set of types that together define the
formatting, language, calendaring, and currency for a locale or culture.
Locale is referenced in OsidSessions to convey the localization of the
service.
Service Managers¶
Locale Profile¶
-
class
dlkit.services.locale.
LocaleProfile
¶ Bases:
dlkit.osid.managers.OsidProfile
The locale profile describes the interoperability of locale services.
-
get_language_types_for_source
(source_language_type, source_script_type)¶ Gets the list of target language types for a given source language type.
Parameters: - source_language_type (
osid.type.Type
) – the type of the source language - source_script_type (
osid.type.Type
) – the type of the source script
Returns: the list of supported types for the given source language type
Return type: osid.type.TypeList
Raise: NullArgument
–source_language_type
isnull
compliance: mandatory – This method must be implemented.
- source_language_type (
-
source_language_types
¶ Gets all the source language types supported.
Returns: the list of supported language types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_script_types_for_language_type
(language_type)¶ Gets the list of script types available for a given language type.
Parameters: language_type ( osid.type.Type
) – the type of the languageReturns: the list of supported script types for the given language type Return type: osid.type.TypeList
Raise: NullArgument
–language_type
isnull
compliance: mandatory – This method must be implemented.
-
numeric_format_types
¶ Gets all the numeric format types supported.
Returns: the list of supported numeric format types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
calendar_types_for_formatting
¶ Gets all the calendar types for which formats are available.
Returns: the list of calendar types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_date_format_types_for_calendar_type
(calendar_type)¶ Gets the list of date format types for a given calendar type.
Parameters: calendar_type ( osid.type.Type
) – the type of the calendarReturns: the list of supported date format types Return type: osid.type.TypeList
Raise: NullArgument
–calendar_type
isnull
compliance: mandatory – This method must be implemented.
-
time_types_for_formatting
¶ Gets all the time types for which formatting is available.
Returns: the list of time types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_time_format_types_for_time_type
(time_type)¶ Gets the list of time format types for a given time type.
Parameters: time_type ( osid.type.Type
) – the type of the timeReturns: the list of supported time format types Return type: osid.type.TypeList
Raise: NullArgument
–time_type
isnull
compliance: mandatory – This method must be implemented.
-
currency_types_for_formatting
¶ Gets all the currency types for which formatting is available.
Returns: the list of currency types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_currency_format_types_for_currency_type
(currency_type)¶ Gets the list of currency format types for a given currency type.
Parameters: currency_type ( osid.type.Type
) – the type of the currencyReturns: the list of supported currency format types Return type: osid.type.TypeList
Raise: NullArgument
–currency_type
isnull
compliance: mandatory – This method must be implemented.
-
coordinate_types_for_formatting
¶ Gets all the coordinate types for which formatting is available.
Returns: the list of coordinate types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_coordinate_format_types_for_coordinate_type
(coordinate_type)¶ Gets the list of coordinate format types for a given coordinate type.
Parameters: coordinate_type ( osid.type.Type
) – the type of the coordinateReturns: the list of supported coordinate format types Return type: osid.type.TypeList
Raise: NullArgument
–coordinater_type
isnull
compliance: mandatory – This method must be implemented.
-
get_unit_types_for_source
(source_unit_type)¶ Gets the list of target measure types for a given source measure type.
Parameters: source_unit_type ( osid.type.Type
) – the type of the source measureReturns: the list of supported target measure types Return type: osid.type.TypeList
Raise: NullArgument
–source_unit_type
isnull
compliance: mandatory – This method must be implemented.
-
source_unit_types
¶ Gets all the source unit types supported.
Returns: the list of supported source unit types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_currency_types_for_source
(source_currency_type)¶ Gets the list of target currency types for a given source currency type.
Parameters: source_currency_type ( osid.type.Type
) – the type of the source currencyReturns: the list of supported currency types Return type: osid.type.TypeList
Raise: NullArgument
–source_currency_type
isnull
compliance: mandatory – This method must be implemented.
-
source_currency_types
¶ Gets the list of source currency types.
Returns: the list of supported source currency types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_calendar_types_for_source
(source_calendar_type)¶ Gets the list of target calendar types for a given source calendar type.
Parameters: source_calendar_type ( osid.type.Type
) – the type of the source calendarReturns: the list of supported calendar types Return type: osid.type.TypeList
Raise: NullArgument
–source_calendar_type
isnull
compliance: mandatory – This method must be implemented.
-
source_calendar_types
¶ Gets the list of source calendar types.
Returns: the list of supported source calendar types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_time_types_for_source
(source_time_type)¶ Gets the list of target time types for a given source time type.
Parameters: source_time_type ( osid.type.Type
) – the type of the source timeReturns: the list of supported time types Return type: osid.type.TypeList
Raise: NullArgument
–source_time_type
isnull
compliance: mandatory – This method must be implemented.
-
source_time_types
¶ Gets the list of source time types.
Returns: the list of supported source time types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_time_types_for_calendar_type
(calendar_type)¶ Gets the list of time types supported for a given calendar type where they are both used in a
DateTime
.Parameters: calendar_type ( osid.type.Type
) – the type of the calendarReturns: the list of supported time types Return type: osid.type.TypeList
Raise: NullArgument
–calendar_type
isnull
compliance: mandatory – This method must be implemented.
-
get_calendar_types_for_time_type
(time_type)¶ Gets the list of calendar types supported for a given time type where they are both used in a
DateTime
.Parameters: time_type ( osid.type.Type
) – the type of the time systemReturns: the list of supported calendar types Return type: osid.type.TypeList
Raise: NullArgument
–time_type
isnull
compliance: mandatory – This method must be implemented.
-
get_coordinate_types_for_source
(source_coordinate_type)¶ Gets the list of target coordinate types for a given source coordinate type.
Parameters: source_coordinate_type ( osid.type.Type
) – the type of the source coordinateReturns: the list of supported target coordinate types Return type: osid.type.TypeList
Raise: NullArgument
–source_coordinate_type
isnull
compliance: mandatory – This method must be implemented.
-
source_coordinate_types
¶ Gets the list of source coordinate types.
Returns: the list of supported source coordinate types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_spatial_unit_record_types_for_source
(source_spatial_unit_record_type)¶ Gets the list of target spatial unit types for a given source spatial unit type.
Parameters: source_spatial_unit_record_type ( osid.type.Type
) – the type of the source spatial unit recordReturns: the list of supported target spatial unit record types Return type: osid.type.TypeList
Raise: NullArgument
–source_spatial_unit_record_type
isnull
compliance: mandatory – This method must be implemented.
-
source_spatial_unit_record_types
¶ Gets the list of source spatial unit record types.
Returns: the list of supported source spatial unit record types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
get_format_types_for_source
(source_format_type)¶ Gets the list of target format types for a given source spatial unit type.
Parameters: source_format_type ( osid.type.Type
) – the type of the source formatReturns: the list of supported target format types Return type: osid.type.TypeList
Raise: NullArgument
–source_format_type
isnull
compliance: mandatory – This method must be implemented.
-
source_format_types
¶ Gets the list of source format types.
Returns: the list of supported source format types Return type: osid.type.TypeList
compliance: mandatory – This method must be implemented.
-
Locale Manager¶
-
class
dlkit.services.locale.
LocaleManager
(proxy=None)¶ Bases:
dlkit.osid.managers.OsidManager
,dlkit.osid.sessions.OsidSession
,dlkit.services.locale.LocaleProfile
The locale manager provides access to locale sessions and provides interoperability tests for various aspects of this service.
The sessions included in this manager are:
TranslationSession:
a session translate stringsTranslationAdminSession: a
session to update the string translations for a localeNumericFormattingSession:
a session for formatting and parsing numbersCalendarFormattingSession:
a session for formatting and parsing dates and timesCurrencyFormattingSession
: a session for formatting and parsing currency amountsCoordinateFormattingSession:
a session for formatting and parsing coordinatesUnitConversionSession:
a session to convert measurement unitsNone
CurrencyConversionSession:
a session to convert currencyCalendarConversionSession:
a session to convert dates across calendarsCoordinateConversionSession:
a session to convert coordinate systemsSpatialUnitConversionSession:
a session to convert spatial unitsFormatConversionSession:
a session to convert text formatsCalendarInfoSession:
a session for examining calendaring and time systems