Module Core_unix.Locale

Locale.

Encapsulates a POSIX locale_t, i.e. a set of language and cultural conventions for dealing with formatting of strings, numbers, dates, times, money, and so on.

It cannot represent the special constants LC_GLOBAL_LOCALE, representing the current global locale, nor (locale_t)0, sometimes used to mean the current thread-local locale.

Most of the operations can raise exceptions, but only in the case of misusing the API or a likely fatal situation such as out-of-memory, so the names are not explicitly suffixed with _exn.

module Category : sig ... end
module Category_set : sig ... end
module Name : sig ... end

Constants for names of standard locales which always exist (in any category).

include sig ... end
type t
include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_compare_lib.Equal.S with type t := t
val equal : t -> t -> bool
include Ppx_compare_lib.Equal.S__local with type t := t
include Ppx_hash_lib.Hashable.S_any with type t := t
include Sexplib0.Sexpable.S with type t := t
include Sexplib0.Sexpable.Of_sexp with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
include Sexplib0.Sexpable.Sexp_of with type t := t
val sexp_of_t : t -> Sexplib0.Sexp.t
val (=) : t -> t -> bool @@ portable
val (<>) : t -> t -> bool @@ portable
include Core.Hashable.S_plain with type t := t
include Ppx_compare_lib.Comparable.S with type t := t
val compare : t -> t -> int
include Ppx_hash_lib.Hashable.S_any with type t := t
val hash_fold_t : t Ppx_hash_lib.hash_fold
val hashable : t Base.Hashable.t
module Table : Core.Hashtbl.S_plain with type key = t
module Hash_set : Core.Hash_set.S_plain with type elt = t
module Hash_queue : Core.Hash_queue.S with type key = t
val posix : t Core.Lazy.t

A singleton locale created with Expert.posix to avoid having to repeatedly construct it. As a result, the destructive operations like Expert.modify and Expert.free must not be called on this locale, as it would interfere with other users.

val native : t Core.Lazy.t

A singleton locale created with Expert.native to avoid having to repeatedly construct it. As a result, the destructive operations like Expert.modify and Expert.free must not be called on this locale, as it would interfere with other users.

module Portable : sig ... end

Versions of posix and native that can be constructed from multiple domains.

val to_string : t -> Category.t -> string

Returns a string representation of the setting of a single category within a locale, in an implementation-defined format that is accepted by Expert.create.

val to_string_hum : t -> string

Returns a human-readable string of the settings of all of the POSIX-standard locale categories within a locale.

val with_ : ?base:t -> ?category_mask:Category_set.t -> string -> (t -> 'a) @ local once -> 'a

Creates a t using Expert.create, calls the provided function with it, and frees it afterwards. Be careful when using it with a Deferred.t-returning function, as it would not wait on the Deferred.t before cleaning up.

val with_multi : ?base:t -> (Category_set.t * string) list -> (t -> 'a) @ local once -> 'a

Creates a t using Expert.create_multi, calls the provided function with it, and frees it afterwards. Be careful when using it with a Deferred.t-returning function, as it would not wait on the Deferred.t before cleaning up.

val with_copy : t -> (t -> 'a) @ local once -> 'a

Creates a t using Expert.copy, calls the provided function with it, and frees it afterwards. Be careful when using it with a Deferred.t-returning function, as it would not wait on the Deferred.t before cleaning up.

val get_current : unit -> t option

Returns the current thread-local locale, or None if the thread-local locale is dynamically tracking the global locale. This gives a direct reference rather than a snapshot.

val with_current : t option -> (unit -> 'a) @ local once -> 'a

Sets the current locale using Expert.set_current, calls the provided function, and restores the current locale to its previous value afterwards. Be careful when using it with a Deferred.t-returning function, as it would not wait on the Deferred.t before cleaning up.

module Expert : sig ... end