X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frbot%2Flanguage.rb;h=67114dac58277eb176b8340317a86f0901252c65;hb=75c90dfd30d17544b2b86323b3993ac5c3083ca9;hp=7cf1ceb994982b0d88491192751dfdf4fc03c6cd;hpb=05dfd4e1a0f4e17c23ae7bfeed776c943c9394fe;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb index 7cf1ceb9..67114dac 100644 --- a/lib/rbot/language.rb +++ b/lib/rbot/language.rb @@ -8,6 +8,7 @@ # .lang file etc. module Irc +class Bot class Language # This constant hash holds the mapping @@ -26,6 +27,8 @@ module Irc :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,8 +57,8 @@ 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 @@ -141,3 +144,4 @@ module Irc end end +end