Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

The dcgettext function allows you to override the current domain for a single
message lookup, and it also allows you to specify a category. The gettext manual
questions the usefulness of this function.


string dgettext(string domain, string message)


The dgettext function allows you to override the current domain for a single message
lookup.


string gettext(string message) string _(string message)


The Gettext function attempts to return a translated string. The message argument is
used as both the key to the translation table and the default text if a translation is not
found. The underscore character is an alias for the gettext function to help reduce
cluttering your code.


<?


//set language to Spanish
putenv("LANG=es");


//specify location of translation tables
bindtextdomain("error_messages", "./locale");


//choose domain
textdomain("error_messages");


//print a test message
print(gettext("This book is named Core PHP
Programming"));
?>


string textdomain(string domain)


The textdomain function sets the domain to search within when calls are made to
gettext. The domain is usually the name of your application. The previous domain is
returned. If you just want to get the current setting, pass an empty string. The default
domain is called messages.


IMAP


IMAP is the Internet Message Access Protocol. It was developed in 1986 at Stanford
University; however, it has been overshadowed by less sophisticated mail protocols, such

Free download pdf