Title: Multilingual Websites with PHP
1???????
- Multilingual Websites with PHP
- Nirav Mehta
- Linux Bangalore 2004
2Session Plan
- Language basics
- Unicode and pre-Unicode
- PHP and Unicode
- Different Solutions
- Example Experiences
- Resources
3There are more than 6800 spoken languages in the
world
- More than 90 of these are spoken by less than 1
lac, 537 are spoken only by 50 people. - There are 46 languages that are spoken only by 1
person. - In India alone, we are have more than 20 official
languages.
4English is predominant on the Internet, yet a
large demand exists for solutions in other
languages
5People came up with many interesting solutions to
represent their languages in the computer
ASCII, ISCII
6Unicode provides globally accepted standards for
encoding all languages / characters
7Unicode fonts display the actual characters.
8UTF-8 is a standard to encode Unicode characters
in numbers.
9PHP does not natively support Unicode, but works
well with UTF-8
10Approach 1 - Create static websites using UTF-8
encoding in HTML
11Approach 2 array of strings used in your
application dynamic text display
12Approach 3 Using tables to store translated text
13Many permutations of the approaches exist
14Approach 4 Using gettext method similar to
GNOME
15PO files are structured text files containing a
msgid and msgstr for the strings in your
application
16Displaying text is very easy. Using the
underscore function - _(string)
17How does this work in real life?
18PEAR has a handful of classes for I18N
19You can detect what languages are supported by
the browser and send appropriate version of
content
20Accepting input in different languages is easy
21MySQL can easily support UTF-8 data
22PHP5 makes it very easy to work with UTF-8
23There are many Open Source PHP packages with
multilingual support
24We have used most of these approaches, but find
gettext the best
25Resources
26Queries?
- Thanks!
- Contact
- Nirav Mehta
- nirav_at_magnet-i.com