SWI-Prolog provides (currently limited) support for localized applications.
A locale is a (optionally named) read-only object that provides
information to locale specific functions.118The
locale interface described in this section and its effect on format/2
and reading integers from digit groups was discussed on the SWI-Prolog
mailinglist. Most input in this discussion is from Ulrich Neumerkel and
Richard O'Keefe. The predicates in this section were designed by Jan
Wielemaker. The system creates a default locale object
named
default
from the system locale. This locale is used as the
initial locale for the three standard streams as well as the
main
thread. Locale sensitive output predicates such as format/3
get their locale from the stream to which they deliver their output. New
streams get their locale from the thread that created the stream.
Threads get their locale from the thread that created them.
"en_EN.UTF-8"
. The values read from the
default locale can be modified using Options. Options
provided are:
grouping
is also specified.
repeat(Count)
,
the remaining digits are grouped in groups of size Count. If
the last element is a normal integer, digits further to the left are not
grouped.
For example, the English locale uses
[ decimal_point('.'), thousands_sep(','), grouping([repeat(3)]) ]
Named locales exists until they are destroyed using locale_destroy/1 and they are no longer referenced. Unnamed locales are subject to (atom) garbage collection.
user_input
, user_output
,
user_error
, current_output
and current_input
.
This locale is used for new streams, unless overruled using the
locale(Locale)
option of open/4
or set_stream/2.