Sha256: bcddeed04b4be73299749ab48651b904fc535ca601e0fda2e0c60d214fe4de41

Contents?: true

Size: 991 Bytes

Versions: 8

Compression:

Stored size: 991 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '../../lib')

require 'test/unit'
require 'rubygems'
if Kernel.respond_to? :gem
  gem 'rails'
else
  require_gem 'rails'
end
require 'initializer'
begin
  require 'rails_info'
rescue Exception
  module Rails
    module Info
      module_function
      def property(name, &block)
	
      end
    end
  end
end
require 'gettext/rails'
require 'stringio'

class TestRails < Test::Unit::TestCase
  def setup_cgi(str)
    $stdin = StringIO.new(str)
    ENV["REQUEST_URI"] = "http://localhost:3000/"
    cgi = CGI.new
    Locale.cgi = cgi
  end

  def test_bindtextdomain
    #query string
    Locale.default = Locale::Object.new("ja_JP.UTF-8")
    GetText.locale = "fr"
    GetText.bindtextdomain("test1", "locale")
    assert_equal("french", GetText._("language"))
    setup_cgi("lang=ja_JP")
    ENV["HTTP_ACCEPT_LANGUAGE"] = "ja,en-us;q=0.7,en;q=0.3"
    GetText.bindtextdomain("test1", "locale")
    assert_equal("french", GetText._("language"))
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gettext-1.10.0-mswin32 test/gettext_test_rails.rb
gettext-1.9.0-mswin32 test/gettext_test_rails.rb
gettext-1.10.0 test/gettext_test_rails.rb
gettext-1.90.0 test/test_rails.rb
gettext-1.9.0 test/gettext_test_rails.rb
gettext-1.91.0 test/test_rails.rb
gettext-1.92.0 test/test_rails.rb
gettext-1.93.0 test/test_rails.rb