Simon Willison’s Weblog

Subscribe

Multi-lingual PHP

30th July 2002

A thread on SitePoint got me thinking about how PHP’s little known parse_ini_file() function could be used to easily manage multiple language versions of web site messages. Sections could be set up for each supported language, with message definitions repeated in each section. You could even have a default message section at the top which is used when a message has not been defined for a particular language. The comments on the parse_ini_file manual page suggest that the function is not particularly suitable for large scale use—PHP exits if the ini file is malformed and it can’t handle files larger than 16,382 bytes. That said, rolling a more reliable native PHP version should be a trivial project.

This is Multi-lingual PHP by Simon Willison, posted on 30th July 2002.

Next: Tabs are not MDI

Previous: Funky stuff coming soon

Previously hosted at http://simon.incutio.com/archive/2002/07/30/multiLanguagePHP