Prev | Current Page 666 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

dll line found in the php.ini file. See Chapter 2 for more information about
configuring PHP.
The remainder of this section guides you through the steps necessary to create a
multilingual Web site using PHP and gettext.
Step 1: Update the Web Site Scripts
Gettext must be able to recognize which strings you??™d like to translate. This is done by
passing all translatable output through the gettext() function. Each time gettext()
is encountered, PHP will look to the language-specific localization repository (more
about this in Step 2), and match the string encompassed within the function to the
corresponding translation. The script knows which translation to retrieve due to
earlier calls to setlocale(), which tells PHP and gettext which language and country
CHAPTER 23 ?–  B U ILDING WE B SITES FOR THE WORLD 593
you want to conform to, and then to bindtextdomain() and textdomain(), which tell
PHP where to look for the translation files.
Pay special attention to the mention of both language and country, because you
shouldn??™t simply pass a language name (e.g., Italian) to setlocale(). Rather, you need
to choose from a predefined combination of language and country codes as defined
by the International Standards Organization. For example, you might want to localize
to English but use the United States number and time/date format. In this case you
would pass en_US to setlocale() as opposed to passing en_GB.


Pages:
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678