Skip to content
Jeff Gordon edited this page Jun 6, 2013 · 4 revisions

français

This component provides ASP, Javascript, Perl, and PHP approaches for automatically linking to different language versions of the current page.

Table of Contents

Overview

Project lead: Jeff Gordon (@jeffdavidgordon)

Rationale

Benefits

  • Simplifies Web page maintenance by eliminating the need to hard code language links
  • Conforms to WCAG 2.0 AA

Recommended usage

  • Linking to different language versions of the current page

Implementation

The language selector is available in both client side and server side implementations. The server side implementation is only required if you want the language selector functionality to work without the use of Javascript.

Client Side Implementation (Javascript/Jquery)

  • To enable secondary jQuery support, add class="wet-boew-langselect" to the language link.
<li id="gcwu-gcnb-lang"><a class="wet-boew-langselect" href="langselect/lang.php" lang="fr">Français</a></li>

Server Side Implementation (PHP, Perl, ASP)

  • Modify the language link on your web page so that its URL points to the location of this project's server-side script (e.g. /demos/langselect/lang.php). The language selector scripts rely on the HTTP_REFERER value but you can append the current URL to the query string when calling the script to improve accuracy:
http://www.gc.ca/cgi-bin/lang?http://www.gc.ca/index-eng.htm

Server Side Implementation (Server Side Includes)

  • See the WET-BOEW/WET-BOEW-SSI project where the language selector has been directly integrated into it.

Known Issues

  • Some browsers can be configured to block the HTTP_REFERER value
Clone this wiki locally