* lib/irb/locale.rb: fix for require "kconv" problem
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
def42c9a0c
commit
cdabb04b44
@ -1,3 +1,7 @@
|
|||||||
|
Fri Jun 22 23:11:17 2001 Keiju Ishitsuka <keiju@ishitsuka.com>
|
||||||
|
|
||||||
|
* lib/irb/locale.rb: fix for require "kconv" problem
|
||||||
|
|
||||||
Fri Jun 22 18:08:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri Jun 22 18:08:45 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_yield_0): no mvalue_to_svalue conversion here.
|
* eval.c (rb_yield_0): no mvalue_to_svalue conversion here.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# irb/locale.rb - internationalization module
|
# irb/locale.rb - internationalization module
|
||||||
# $Release Version: 0.7.3$
|
# $Release Version: 0.7.4$
|
||||||
# $Revision$
|
# $Revision$
|
||||||
# $Date$
|
# $Date$
|
||||||
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
||||||
@ -10,7 +10,8 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
require "kconv"
|
autoload :Tempfile, "tempfile"
|
||||||
|
autoload :Kconv, "kconv"
|
||||||
|
|
||||||
module IRB
|
module IRB
|
||||||
class Locale
|
class Locale
|
||||||
@ -19,16 +20,6 @@ module IRB
|
|||||||
JPDefaultLocale = "ja"
|
JPDefaultLocale = "ja"
|
||||||
LOCALE_DIR = "/lc/"
|
LOCALE_DIR = "/lc/"
|
||||||
|
|
||||||
LC2KCONV = {
|
|
||||||
# "ja" => Kconv::JIS,
|
|
||||||
# "ja_JP" => Kconv::JIS,
|
|
||||||
"ja_JP.ujis" => Kconv::EUC,
|
|
||||||
"ja_JP.euc" => Kconv::EUC,
|
|
||||||
"ja_JP.eucJP" => Kconv::EUC,
|
|
||||||
"ja_JP.sjis" => Kconv::SJIS,
|
|
||||||
"ja_JP.SJIS" => Kconv::SJIS,
|
|
||||||
}
|
|
||||||
|
|
||||||
def initialize(locale = nil)
|
def initialize(locale = nil)
|
||||||
@lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"]
|
@lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"]
|
||||||
@lang = "C" unless @lang
|
@lang = "C" unless @lang
|
||||||
@ -40,7 +31,17 @@ module IRB
|
|||||||
mes = super(mes)
|
mes = super(mes)
|
||||||
case @lang
|
case @lang
|
||||||
when /^ja/
|
when /^ja/
|
||||||
mes = Kconv::kconv(mes, LC2KCONV[@lang])
|
@@LC2KCONV = {
|
||||||
|
# "ja" => Kconv::JIS,
|
||||||
|
# "ja_JP" => Kconv::JIS,
|
||||||
|
"ja_JP.ujis" => Kconv::EUC,
|
||||||
|
"ja_JP.euc" => Kconv::EUC,
|
||||||
|
"ja_JP.eucJP" => Kconv::EUC,
|
||||||
|
"ja_JP.sjis" => Kconv::SJIS,
|
||||||
|
"ja_JP.SJIS" => Kconv::SJIS,
|
||||||
|
} unless defined? @@LC2KCONV
|
||||||
|
|
||||||
|
mes = Kconv::kconv(mes, @@LC2KCONV[@lang])
|
||||||
else
|
else
|
||||||
mes
|
mes
|
||||||
end
|
end
|
||||||
@ -74,8 +75,6 @@ module IRB
|
|||||||
super *ary
|
super *ary
|
||||||
end
|
end
|
||||||
|
|
||||||
autoload :Tempfile, "tempfile"
|
|
||||||
|
|
||||||
def require(file, priv = nil)
|
def require(file, priv = nil)
|
||||||
rex = Regexp.new("lc/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
|
rex = Regexp.new("lc/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
|
||||||
return false if $".find{|f| f =~ rex}
|
return false if $".find{|f| f =~ rex}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user