A properties bundle consists of multiple properties files that vary in the file name by an injection of a locale code before the file extension. Our convention is that each bundle must contain a properties file without injection. This file acts as a root for the bundle and as a fall-back for locales that are not found:Examples:
code.properties: The root and fall-back.
code_de.properties: The German member of the bundle.
The predicates sys_get_lang/2 and sys_get_lang/3 allow retrieving a locale properties file of a resource bundle. These predicates make use of the predicate absolute_resource_name/2 to resolve the root so that the same base name without an extension can be used for both Prolog text and resource bundles. The resource bundle itself has to be loaded in advanced via the predicate sys_load_resoruce/1.Examples:
test(Y) :- sys_get_lang('code',X), get_property(X,'foo',Y).
X = bar
The retrieval of a locale properties file is relatively fast,
since we cache locale properties files on a per resource bundle
basis. But it still not yet as fast and flexible as predicate
invocation, since we have not yet implemented a call-site cache
and an auto loader for resource bundles. The predicates
get_property/3 and get_property/4 allow retrieving a property
value from a locale properties file.
The predicate atom_format/[3,4] allows formatting a list of arguments based on a template and a locale. The predicates message_make/[3,4] and error_make/[3,4] allow formatting a term based on properties file and a locale. The predicates get_error_properties/[1,2] and get_description_properties/[2,3] allow retrieving knowledgebase respective capability defined properties files.The following locale predicates are provided:
The following locale Prolog flags are provided: