diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-26 16:38:34 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-26 16:38:34 +0000 |
commit | 3388fc7d3feea19f07e16c2cf62b89acabc56c4e (patch) | |
tree | a61b54f6ff2cb8339bf2cd89108bb119b0220d06 /lib/rbot | |
parent | de9473ac156a8df6e44fa12164c3c727394c6aff (diff) |
Only use locale functions when GetText was loaded
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/language.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb index c9130ee0..5fbbfefd 100644 --- a/lib/rbot/language.rb +++ b/lib/rbot/language.rb @@ -30,6 +30,7 @@ module Language # Return the shortest language for the current # GetText locale def Language.from_locale + return 'english' unless defined?(GetText) lang = locale.language if locale.country str = lang + "_#{locale.country}" @@ -67,7 +68,7 @@ module Language def set_language(language) lang_str = language.to_s.downcase.gsub(/\s+/,'_') lang_sym = lang_str.intern - if Lang2Locale.key?(lang_sym) + if defined?(GetText) and Lang2Locale.key?(lang_sym) setlocale(Lang2Locale[lang_sym]) debug "locale set to #{locale}" rbot_gettext_debug |