text_domain()
Set or get the name of the current domain.
Syntax
Parameter
Parameter | Definition |
---|---|
domain_name | file name for message catalog Use only characters that are permitted in file names. Valid Values *Default* |
Description
The text_domain() function sets or gets the name of the current domain. The domain_name determines the name of a string-based catalog file according to the following format:
Using 0 as domain_name causes text_domain() to return the value of the current domain name. When domain_name is the NULL character (""), text_domain() sets the current domain to the default value (messages). Using a valid domain name fordomain_name sets this value as the domain. When text_domain() successfully sets the domain, it returns the new value of the domain. You may want to use text_domain() before get_text() because get_text() uses the current setting of the domain name.
Example
The following example demonstrates the text_domain() function.
printf("Current domain is %s\n", ret);
ret = text_domain("test_msg");
printf("Domain set to %s \n", ret);
ret = text_domain("");
printf("Domain set to default value of %s \n", ret);
The previous example produces the following output:
Domain set to test_msg
Domain set to default value of messages