From 33c336af346dc08b4f4f4951dd6eae7150cef481 Mon Sep 17 00:00:00 2001 From: Yaohan Chen Date: Thu, 5 Jun 2008 22:20:18 -0400 Subject: each plugin uses its own po file no modification in plugin source is needed, plugin loader is modified to automatically bind to the plugin's text domain updatepo task is modified to maintain per-plugin po file po files are updated and cleaned --- lib/rbot/load-gettext.rb | 3 +++ lib/rbot/plugins.rb | 2 ++ 2 files changed, 5 insertions(+) (limited to 'lib/rbot') diff --git a/lib/rbot/load-gettext.rb b/lib/rbot/load-gettext.rb index 4d39b7e4..4edc45c8 100644 --- a/lib/rbot/load-gettext.rb +++ b/lib/rbot/load-gettext.rb @@ -87,6 +87,9 @@ rescue LoadError, GetTextVersionError args[0] end + def bindtextdomain_to(*args) + end + # the following extension to String#% is from ruby-gettext's string.rb file. # it needs to be included in the fallback since the source already use this form diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 250efa01..d1bf073a 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -533,6 +533,8 @@ module Plugins # the idea here is to prevent namespace pollution. perhaps there # is another way? plugin_module = Module.new + # each plugin uses its own textdomain, we bind it automatically here + bindtextdomain_to(plugin_module, "rbot-#{File.basename(fname, '.rb')}") desc = desc.to_s + " " if desc -- cgit v1.2.3