#!/usr/bin/env ruby =begin index.cgi - Sample script for CGI Copyright (C) 2008 Masao Mutoh You may redistribute it and/or modify it under the same license terms as Ruby. =end $:<< "../../lib" begin require 'rubygems' rescue LoadError end require 'locale' require 'cgi' # Initialize Locale library. Locale.init(:driver => :cgi) cgi = CGI.new Locale.set_cgi(cgi) url_base = "http://#{cgi.server_name}:#{cgi.server_port}/" sample_locales = ["en-US", "fr-FR", "ja-JP"] langs = Locale.candidates(:type => :common) #Try :rfc, :simple and others. # # CGI part # print "Content-type:text/html; charset=UTF-8\n\n" puts %Q[
Requested Locales order by the priority:
Click one of the link below, and then click "Auto-Detect the locale from the WWW browser".
Copyright (C) 2008 Masao Mutoh