diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-07-20 10:21:56 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2010-07-20 10:21:56 +0200 |
commit | 41d45296886b4814744fc2d1422838d643399a61 (patch) | |
tree | 9a7e50493b9e3c980d12f8a14878878f620eddd0 /data | |
parent | ac4c4b7f6b93fe0d33148a6630fad55812acf11b (diff) |
geoip: massage a few messages
Solve a few gettext issue, and re-introduce the commas around the
region.
Diffstat (limited to 'data')
-rwxr-xr-x | data/rbot/plugins/geoip.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/data/rbot/plugins/geoip.rb b/data/rbot/plugins/geoip.rb index 3b7bf751..99ed71eb 100755 --- a/data/rbot/plugins/geoip.rb +++ b/data/rbot/plugins/geoip.rb @@ -183,32 +183,30 @@ class GeoIpPlugin < Plugin } rescue GeoIP::InvalidHostError, RuntimeError if nick - return _("#{nick}'s location could not be resolved") + return _("%{nick}'s location could not be resolved") % { :nick => nick } else - return _("#{host} could not be resolved") + return _("%{host} could not be resolved") % { :host => host } end rescue GeoIP::BadAPIError return _("The owner configured me to use an API that doesn't exist, bug them!") end - res = _("%{thing} is #{nick ? "from" : "located in"}") % { - :thing => (nick ? nick : Resolv::getaddress(host)), - :country => geo[:country] - } - - res << " %{city}" % { - :city => geo[:city] - } unless geo[:city].to_s.empty? + location = [] + location << geo[:city] unless geo[:city].nil_or_empty? + location << geo[:region] unless geo[:region].nil_or_empty? or geo[:region] == geo[:city] + location << geo[:country] unless geo[:country].nil_or_empty? - res << " %{region}," % { - :region => geo[:region] - } unless geo[:region].to_s.empty? || geo[:region] == geo[:city] + if nick + res = _("%{nick} is from %{location}") + else + res = _("%{host} is located in %{location}") + end - res << " %{country}" % { - :country => geo[:country] + return res % { + :nick => nick, + :host => host, + :location => location.join(', ') } - - return res end end |