Previous Up Next

Module JavaLocale

module JavaLocale: sig .. end
Utility functions for Java locales.


Instance creation

type t = java'util'Locale java_instance
The type of locales.
val make : ?country:JavaString.t ->
?variant:JavaString.t -> language:JavaString.t -> t
Returns a new java.util.Locale instance, for the passed language, country and variant. variant is ignored if no country is passed.
Raises Java_exception if language is null
val get_available_locales : unit -> t list
Returns the list of all available locales.
val get_default : unit -> t
Returns the default locale.
val set_default : t -> unit
set_default loc changes the default locale to loc.
Raises Java_exception if loc is null

Properties

val get_display_name : t -> JavaString.t
Returns the name of the passed locale; see getDisplayName(...) .
val get_language : t -> JavaString.t
Returns the language of the passed locale; see getLanguage(...) .
val get_display_language : t -> JavaString.t
Returns the language of the passed locale; see getDisplayLanguage(...) .
val get_iso3_language : t -> JavaString.t
Returns the language of the passed locale; see getISO3Language(...) .
val get_country : t -> JavaString.t
Returns the country of the passed locale; see getCountry(...) .
val get_display_country : t -> JavaString.t
Returns the country of the passed locale; see getDisplayCountry(...) .
val get_iso3_country : t -> JavaString.t
Returns the country of the passed locale; see getISO3Country(...) .
val get_variant : t -> JavaString.t
Returns the variant of the passed locale; see getVariant(...) .
val get_display_variant : t -> JavaString.t
Returns the variant of the passed locale; see getDisplayVariant(...) .
val get_script : t -> JavaString.t
Returns the script of the passed locale; see getScript(...) .
val get_display_script : t -> JavaString.t
Returns the script of the passed locale; see getDisplayScript(...) .
val to_language_tag : t -> JavaString.t
Returns the IETF BCP 47 language tag of the passed locale; see toLanguageTag(...) .

Predefined locales


Languages

val chinese : unit -> t
val english : unit -> t
val french : unit -> t
val german : unit -> t
val italian : unit -> t
val japanese : unit -> t
val korean : unit -> t
val simplified_chinese : unit -> t
val traditional_chinese : unit -> t

countries

val canada : unit -> t
val canada_french : unit -> t
val china : unit -> t
val france : unit -> t
val germany : unit -> t
val italy : unit -> t
val japan : unit -> t
val korea : unit -> t
val prc : unit -> t
val taiwan : unit -> t
val uk : unit -> t
val us : unit -> t

Null value

val null : t
The null value.
val is_null : t -> bool
is_null obj returns true iff obj is equal to null.
val is_not_null : t -> bool
is_not_null obj returns false iff obj is equal to null.

Miscellaneous

val wrap : t -> t option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

val unwrap : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.

AltStyle によって変換されたページ (->オリジナル) /