Sha256: 1ff64f59b49edd5f3b3a27fdde6b95532eae69b90d178a92eabb741147146f32

Contents?: true

Size: 1 KB

Versions: 22

Compression:

Stored size: 1 KB

Contents

#!/usr/bin/env ruby
=begin
  helloerb1.cgi - Sample script for CGI/ERB

  Set UTF-8 forcely as output charset.

  Recommanded to set UTF-8 forcely because some web browser
  doesn't send HTTP_ACCEPT_CHARSET correctly.

  Copyright (C) 2005  Masao Mutoh

  You may redistribute it and/or modify it under the same
  license terms as Ruby.
=end
begin
  require 'rubygems'
rescue LoadError
end

require 'gettext/cgi'
require 'gettext/erb'

class SimpleContainer1
  include GetText::ErbContainer

  def initialize(domainname, domainpath = nil, locale = nil, charset = nil)
    bindtextdomain(domainname, domainpath, locale)
    @domainname = domainname
  end

  def description
    _("Sample script for CGI/ERB (UTF-8).")
  end

  def to_html(path)
    eval_file(path)
  end
end


GetText.output_charset = "UTF-8"

print "Content-type:text/html; charset=UTF-8\n\n"

con = SimpleContainer1.new("helloerb1", "locale")

if GetText.cgi["other"] == "true"
  print con.to_html("other.rhtml")
else
  print con.to_html("helloerb.rhtml")
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.9.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.8.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.7.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.6.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.5.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.4.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.3.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.2.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.1.1-mswin32 samples/cgi/helloerb1.cgi
gettext-1.1.0-mswin32 samples/cgi/helloerb1.cgi
gettext-1.10.0 samples/cgi/helloerb1.cgi
gettext-1.1.1 samples/cgi/helloerb1.cgi
gettext-1.1.0 samples/cgi/helloerb1.cgi
gettext-1.2.0 samples/cgi/helloerb1.cgi
gettext-1.5.0 samples/cgi/helloerb1.cgi
gettext-1.3.0 samples/cgi/helloerb1.cgi
gettext-1.4.0 samples/cgi/helloerb1.cgi
gettext-1.7.0 samples/cgi/helloerb1.cgi
gettext-1.6.0 samples/cgi/helloerb1.cgi