- Reference manual
- Built-in Predicates
- Notation of Predicate Descriptions
- Character representation
- Loading Prolog source files
- Editor Interface
- List the program, predicates or clauses
- Verify Type of a Term
- Comparison and Unification of Terms
- Control Predicates
- Meta-Call Predicates
- Delimited continuations
- Exception handling
- Handling signals
- DCG Grammar rules
- Declaring predicate properties
- Examining the program
- Input and output
- Status of streams
- Primitive character I/O
- Term reading and writing
- Analysing and Constructing Terms
- Analysing and Constructing Atoms
- Localization (locale) support
- Character properties
- Character Conversion
- Misc arithmetic support predicates
- Built-in list operations
- Finding all Solutions to a Goal
- Formatted Write
- Global variables
- Terminal Control
- Operating System Interaction
- File System Interaction
- User Top-level Manipulation
- Creating a Protocol of the User Interaction
- Debugging and Tracing Programs
- Obtaining Runtime Statistics
- Execution profiling
- Memory Management
- Windows DDE interface
- Built-in Predicates
- Reference manual
SWI-Prolog provides (currently limited) support for localized applications.
- The predicates char_type/2 and code_type/2 query character classes depending on the locale.
- The predicates collation_key/2 and locale_sort/2 can be used for locale dependent sorting of atoms.
- The predicate format_time/3 can be used to format time and date representations, where some of the specifiers are locale dependent.
- The predicate format/2 provides locale-specific formating of numbers. This functionality is based on a more fine-grained localization model that is the subject of this section.
A locale is a (optionally named) read-only object that provides
information to locale specific functions.113The
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
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.
- locale_create(-Locale, +Default, +Options)
- Create a new locale object. Default is either an existing
locale or a string that denotes the name of a locale provided by the
system, such as
"en_EN.UTF-8". The values read from the default locale can be modified using Options. Options provided are:
- Give the locale a name.
- Specify the decimal point to use.
- Specify the string that delimits digit groups. Only effective is
groupingis also specified.
- Specify the grouping of digits. Groups are created from the right (least
significant) digits, left of the decimal point. List is a
list of integers, specifying the number of digits in each group,
counting from the right. If the last element is
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.
- Destroy a locale. If the locale is named, this removes the name association from the locale, after which the locale is left to be reclaimed by garbage collection.
- locale_property(?Locale, ?Property)
- True when Locale has Property. Properties are the same as the Options described with locale_create/3.
- Set the default locale for the current thread, as well as the locale for
the standard streams (
current_input. This locale is used for new streams, unless overruled using the
locale(Locale)option of open/4 or set_stream/2.
- True when Locale is the locale of the calling thread.