---

Create a Localized Web Page with PHP

“The process of making your applications/websites usable in many
different locales is called internationalization, While customizing
your code for different locales is called localization.
Localization is the process of making your applications or websites
local to where it is being viewed. For example, you can make a
website more local to a particular place by converting its text to
the predominate language of that location and by displaying the
local time (e.g. German for people living in Germany or French for
people living in France).

“Yahoo and Google have examples of localized sites: Google.com
(US), Google.co.uk (UK), Yahoo.jp (Japan) and so forth. Creating a
Web site that is useful to speakers of different languages is a
breeze using PHP. In this article, we look at how to create a
localized welcome page that uses PHP to enable a user to select a
target language and then receive the appropriate text. An example
of externalizing the strings used in this script — one of the
characteristics of internationalization — will also be
provided.

“The Structure of a Localized Web Page

“In this example, the user will choose one of three languages
and the website will then display a welcome message in the chosen
language. Because we want the welcome page to be locale specific,
we need to find a way to send information to the welcome page that
will tell it what language to use and how to render the text. Thus,
we need three things:”

Complete
Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis