From 3388fc7d3feea19f07e16c2cf62b89acabc56c4e Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 26 Aug 2007 16:38:34 +0000 Subject: Only use locale functions when GetText was loaded --- lib/rbot/language.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/rbot') 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 -- cgit v1.2.3