summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
authorkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-22 14:16:25 +0000
committerkeiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-22 14:16:25 +0000
commitcdabb04b442dcbe58e201c18aa8aec80b2d63a02 (patch)
treecb65a49127a649d3009eb84f7572f7c960e5f1e4 /lib/irb
parentdef42c9a0cd274202da56531c19e0a4bee3364e3 (diff)
* 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
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/locale.rb29
1 files changed, 14 insertions, 15 deletions
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index ef92ea1..0eeeae0 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -1,6 +1,6 @@
#
# irb/locale.rb - internationalization module
-# $Release Version: 0.7.3$
+# $Release Version: 0.7.4$
# $Revision$
# $Date$
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
@@ -10,7 +10,8 @@
#
#
-require "kconv"
+autoload :Tempfile, "tempfile"
+autoload :Kconv, "kconv"
module IRB
class Locale
@@ -19,16 +20,6 @@ module IRB
JPDefaultLocale = "ja"
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)
@lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"]
@lang = "C" unless @lang
@@ -40,7 +31,17 @@ module IRB
mes = super(mes)
case @lang
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
mes
end
@@ -74,8 +75,6 @@ module IRB
super *ary
end
- autoload :Tempfile, "tempfile"
-
def require(file, priv = nil)
rex = Regexp.new("lc/#{Regexp.quote(file)}\.(so|o|sl|rb)?")
return false if $".find{|f| f =~ rex}