diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-08-03 20:07:14 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-08-03 20:07:14 +0000 |
commit | dd0b318cfd3df017b1ec4e44afc2f4e412fd2033 (patch) | |
tree | e364fc26af86c1105124385d8da2768262e97d23 /lib/rbot/language.rb | |
parent | fba4b7bba7a5d15f2b98f4d9f1ece390881c5ae9 (diff) |
Wed Aug 03 15:25:07 BST 2005 Tom Gilbert <tom@linuxbrit.co.uk>
* Added french language file (TODO most of the plugins just talk english)
* The way the Enum configs were set up, it wasn't possible to add language
files to rbot at runtime (the directory was only scanned at startup). Now
you can set a values Proc, which is called to return a list of allowed
values whenever it's queried.
* Added Config module for determining where we were installed.
Unfortunately rubygems is a total whore in this regard, and I hope the
current hackery I have to do to support it becomes redundant in the
future.
Diffstat (limited to 'lib/rbot/language.rb')
-rw-r--r-- | lib/rbot/language.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb index c472c12e..1a4a889a 100644 --- a/lib/rbot/language.rb +++ b/lib/rbot/language.rb @@ -4,9 +4,11 @@ module Language class Language BotConfig.register BotConfigEnumValue.new('core.language', :default => "english", :wizard => true, - :values => Dir.new(Config::DATADIR + "/languages").collect {|f| - f =~ /\.lang$/ ? f.gsub(/\.lang$/, "") : nil - }.compact, + :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") @@ -15,7 +17,7 @@ module Language end def set_language(language) - file = Config::DATADIR + "/languages/#{language}.lang" + file = Config::datadir + "/languages/#{language}.lang" unless(FileTest.exist?(file)) raise "no such language: #{language} (no such file #{file})" end |