summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rbot/language.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb
index 7c472303..d40fdecc 100644
--- a/lib/rbot/language.rb
+++ b/lib/rbot/language.rb
@@ -62,23 +62,23 @@ module Language
@bot = bot
set_language language
end
- attr_reader :language, :locale
+ attr_reader :language
def set_language(language)
- l = language.to_s.gsub(/\s+/,'_').intern
- if Lang2Locale.key?(l)
- @locale = Lang2Locale[l]
- setlocale(@locale)
+ lang_str = language.to_s.downcase.gsub(/\s+/,'_')
+ lang_sym = lang_str.intern
+ if Lang2Locale.key?(lang_sym)
+ setlocale(Lang2Locale[lang_sym])
debug "locale set to #{locale}"
else
- warn "Unable to set locale, unknown language #{l}"
+ warn "Unable to set locale, unknown language #{language} (#{lang_str})"
end
- file = Config::datadir + "/languages/#{language}.lang"
+ file = Config::datadir + "/languages/#{lang_str}.lang"
unless(FileTest.exist?(file))
- raise "no such language: #{language} (no such file #{file})"
+ raise "no such language: #{lang_str} (no such file #{file})"
end
- @language = language
+ @language = lang_str
@file = file
scan
return if @bot.plugins.nil?