3 ms·
For an example implementation, see the web site I made for Audacity (an open-source audio editor): http://audacity.sourceforge.net/ http://audacity.sourceforge
by mbrubeck 17y ago
For an example implementation, see the web site I made for Audacity (an open-source audio editor):
http://audacity.sourceforge.net/ http://audacity.sourceforge.net/
By default it uses the Accept-Language header, but the user can override this by clicking a link in the footer. Clicking the link sets a cookie, so that the user's preference is remembered on subsequent visits. The link also acts as a permalink to the page in that language, so that they can be bookmarked or indexed separately. Localization is done with gettext. (Sadly, most of the translations have gotten out of date in the four years since the site launched.)
The PHP source code is CC-licensed. Here's the most relevant file:
http://audacity.cvs.sourceforge.net/viewvc/audacity/htdocs/include/lang.inc.php?revision=1.24&view=markup http://audacity.cvs.sourceforge.net/viewvc/audacity/htdocs/i...