]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/language.rb
Saner treatment for connect errors
[user/henk/code/ruby/rbot.git] / lib / rbot / language.rb
index 7cf1ceb994982b0d88491192751dfdf4fc03c6cd..ae750ad93868b6dc498c2a9b1d2fe1e7877f36ce 100644 (file)
@@ -8,6 +8,7 @@
 # .lang file etc.
 
 module Irc
+class Bot
   class Language
 
     # This constant hash holds the mapping
@@ -23,9 +24,12 @@ module Irc
       :dutch    => 'nl',
       :japanese => 'ja',
       :russian  => 'ru',
+      :finnish  => 'fi',
       :traditional_chinese => 'zh_TW',
       :simplified_chinese => 'zh_CN'
     }
+    # On WIN32 it appears necessary to have ".UTF-8" explicitly for gettext to use UTF-8
+    Lang2Locale.each_value {|v| v.replace(v + '.UTF-8')}
 
     # Return the shortest language for the current
     # GetText locale
@@ -54,16 +58,16 @@ module Irc
       return 'english'
     end
 
-    BotConfig.register BotConfigEnumValue.new('core.language', 
-      :default => Irc::Language.from_locale, :wizard => true,
+    Config.register Config::EnumValue.new('core.language',
+      :default => Irc::Bot::Language.from_locale, :wizard => true,
       :values => Proc.new{|bot|
             Dir.new(Config::datadir + "/languages").collect {|f|
               f =~ /\.lang$/ ? f.gsub(/\.lang$/, "") : nil
             }.compact
-          },   
+          },
       :on_change => Proc.new {|bot, v| bot.lang.set_language v},
       :desc => "Which language file the bot should use")
-    
+
     def initialize(bot, language)
       @bot = bot
       set_language language
@@ -141,3 +145,4 @@ module Irc
   end
 
 end
+end