summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/alias.rb9
-rw-r--r--po/en_US/rbot.po28
-rw-r--r--po/ja/rbot.po28
-rw-r--r--po/rbot.pot28
-rw-r--r--po/zh_CN/rbot.po28
-rw-r--r--po/zh_TW/rbot.po28
6 files changed, 86 insertions, 63 deletions
diff --git a/data/rbot/plugins/alias.rb b/data/rbot/plugins/alias.rb
index 2fba9324..218754a6 100644
--- a/data/rbot/plugins/alias.rb
+++ b/data/rbot/plugins/alias.rb
@@ -43,9 +43,12 @@ class AliasPlugin < Plugin
@data_path = "#{@bot.botclass}/alias/"
@data_file = "#{@data_path}/aliases.yaml"
# hash of alias => command entries
- @aliases = if File.exist?(@data_file)
- YAML.load_file(@data_file)
+ @aliases = if File.exist?(@data_file) &&
+ data = YAML.load_file(@data_file) &&
+ data.respond_to?(:each_pair)
+ data
else
+ warning _("Data file is not found or corrupt, reinitializing data")
Hash.new
end
@aliases.each_pair do |a, c|
@@ -60,7 +63,7 @@ class AliasPlugin < Plugin
def save
Dir.mkdir(@data_path) unless File.exist?(@data_path)
- File.open(@data_file, 'w') {|f| f.write @aliases.to_yaml}
+ Utils.safe_save(@data_file) {|f| f.write @aliases.to_yaml}
end
def cmd_add(m, params)
diff --git a/po/en_US/rbot.po b/po/en_US/rbot.po
index 25301781..56d0e22e 100644
--- a/po/en_US/rbot.po
+++ b/po/en_US/rbot.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: rbot\n"
-"POT-Creation-Date: 2007-08-01 00:47-0400\n"
+"POT-Creation-Date: 2007-08-07 16:41-0400\n"
"PO-Revision-Date: 2007-07-14 00:06-0400\n"
"Last-Translator: Yaohan Chen <yaohan.chen@gmail.com>\n"
"Language-Team: English\n"
@@ -945,47 +945,51 @@ msgstr ""
"dictclient databases => List databases; dictclient strategies => List "
"strategies"
-#: data/rbot/plugins/alias.rb:55
+#: data/rbot/plugins/alias.rb:51
+msgid "Data file is not found or corrupt, reinitializing data"
+msgstr ""
+
+#: data/rbot/plugins/alias.rb:58
msgid "Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:71
+#: data/rbot/plugins/alias.rb:74
msgid "The definition you provided is invalid: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:82 data/rbot/plugins/alias.rb:99
+#: data/rbot/plugins/alias.rb:85 data/rbot/plugins/alias.rb:102
msgid "No such alias is defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:88
+#: data/rbot/plugins/alias.rb:91
msgid "No aliases defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:97
+#: data/rbot/plugins/alias.rb:100
msgid "Alias of %{command}"
msgstr ""
-#: data/rbot/plugins/alias.rb:109
+#: data/rbot/plugins/alias.rb:112
msgid ""
"The arguments in alias must match the substitutions in command, and vice "
"versa"
msgstr ""
-#: data/rbot/plugins/alias.rb:126
+#: data/rbot/plugins/alias.rb:129
msgid ""
"The alias seems to have caused infinite recursion. Please examine your alias "
"definitions"
msgstr ""
-#: data/rbot/plugins/alias.rb:142
+#: data/rbot/plugins/alias.rb:145
msgid "Error handling the alias, the command is not defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:152
+#: data/rbot/plugins/alias.rb:155
msgid "Create and use aliases for commands. Topics: create, commands"
msgstr ""
-#: data/rbot/plugins/alias.rb:154
+#: data/rbot/plugins/alias.rb:157
msgid ""
"\"alias <text> => <command>\" => add text as an alias of command. Text can "
"contain placeholders marked with : or * for :words and *multiword arguments. "
@@ -994,7 +998,7 @@ msgid ""
"google site:linuxbrit.co.uk/rbot/ <terms>"
msgstr ""
-#: data/rbot/plugins/alias.rb:156
+#: data/rbot/plugins/alias.rb:159
msgid ""
"alias list => list defined aliases | alias whatis <alias> => show definition "
"of the alias | alias remove <alias> => remove defined alias | see the "
diff --git a/po/ja/rbot.po b/po/ja/rbot.po
index 1ab53841..adbd5651 100644
--- a/po/ja/rbot.po
+++ b/po/ja/rbot.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: rbot\n"
-"POT-Creation-Date: 2007-08-01 00:47-0400\n"
+"POT-Creation-Date: 2007-08-07 16:41-0400\n"
"PO-Revision-Date: 2007-07-09 01:36-0400\n"
"Last-Translator: Yaohan Chen <yaohan.chen@gmail.com>\n"
"Language-Team: Japanese\n"
@@ -829,47 +829,51 @@ msgid ""
"strategies"
msgstr ""
-#: data/rbot/plugins/alias.rb:55
+#: data/rbot/plugins/alias.rb:51
+msgid "Data file is not found or corrupt, reinitializing data"
+msgstr ""
+
+#: data/rbot/plugins/alias.rb:58
msgid "Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:71
+#: data/rbot/plugins/alias.rb:74
msgid "The definition you provided is invalid: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:82 data/rbot/plugins/alias.rb:99
+#: data/rbot/plugins/alias.rb:85 data/rbot/plugins/alias.rb:102
msgid "No such alias is defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:88
+#: data/rbot/plugins/alias.rb:91
msgid "No aliases defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:97
+#: data/rbot/plugins/alias.rb:100
msgid "Alias of %{command}"
msgstr ""
-#: data/rbot/plugins/alias.rb:109
+#: data/rbot/plugins/alias.rb:112
msgid ""
"The arguments in alias must match the substitutions in command, and vice "
"versa"
msgstr ""
-#: data/rbot/plugins/alias.rb:126
+#: data/rbot/plugins/alias.rb:129
msgid ""
"The alias seems to have caused infinite recursion. Please examine your alias "
"definitions"
msgstr ""
-#: data/rbot/plugins/alias.rb:142
+#: data/rbot/plugins/alias.rb:145
msgid "Error handling the alias, the command is not defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:152
+#: data/rbot/plugins/alias.rb:155
msgid "Create and use aliases for commands. Topics: create, commands"
msgstr ""
-#: data/rbot/plugins/alias.rb:154
+#: data/rbot/plugins/alias.rb:157
msgid ""
"\"alias <text> => <command>\" => add text as an alias of command. Text can "
"contain placeholders marked with : or * for :words and *multiword arguments. "
@@ -878,7 +882,7 @@ msgid ""
"google site:linuxbrit.co.uk/rbot/ <terms>"
msgstr ""
-#: data/rbot/plugins/alias.rb:156
+#: data/rbot/plugins/alias.rb:159
msgid ""
"alias list => list defined aliases | alias whatis <alias> => show definition "
"of the alias | alias remove <alias> => remove defined alias | see the "
diff --git a/po/rbot.pot b/po/rbot.pot
index a55b990c..f78fc2d5 100644
--- a/po/rbot.pot
+++ b/po/rbot.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: rbot\n"
-"POT-Creation-Date: 2007-08-01 00:47-0400\n"
+"POT-Creation-Date: 2007-08-07 16:41-0400\n"
"PO-Revision-Date: 2007-07-09 01:24-0400\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -839,47 +839,51 @@ msgid ""
"strategies"
msgstr ""
-#: data/rbot/plugins/alias.rb:55
+#: data/rbot/plugins/alias.rb:51
+msgid "Data file is not found or corrupt, reinitializing data"
+msgstr ""
+
+#: data/rbot/plugins/alias.rb:58
msgid "Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:71
+#: data/rbot/plugins/alias.rb:74
msgid "The definition you provided is invalid: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:82 data/rbot/plugins/alias.rb:99
+#: data/rbot/plugins/alias.rb:85 data/rbot/plugins/alias.rb:102
msgid "No such alias is defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:88
+#: data/rbot/plugins/alias.rb:91
msgid "No aliases defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:97
+#: data/rbot/plugins/alias.rb:100
msgid "Alias of %{command}"
msgstr ""
-#: data/rbot/plugins/alias.rb:109
+#: data/rbot/plugins/alias.rb:112
msgid ""
"The arguments in alias must match the substitutions in command, and vice "
"versa"
msgstr ""
-#: data/rbot/plugins/alias.rb:126
+#: data/rbot/plugins/alias.rb:129
msgid ""
"The alias seems to have caused infinite recursion. Please examine your alias "
"definitions"
msgstr ""
-#: data/rbot/plugins/alias.rb:142
+#: data/rbot/plugins/alias.rb:145
msgid "Error handling the alias, the command is not defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:152
+#: data/rbot/plugins/alias.rb:155
msgid "Create and use aliases for commands. Topics: create, commands"
msgstr ""
-#: data/rbot/plugins/alias.rb:154
+#: data/rbot/plugins/alias.rb:157
msgid ""
"\"alias <text> => <command>\" => add text as an alias of command. Text can "
"contain placeholders marked with : or * for :words and *multiword arguments. "
@@ -888,7 +892,7 @@ msgid ""
"google site:linuxbrit.co.uk/rbot/ <terms>"
msgstr ""
-#: data/rbot/plugins/alias.rb:156
+#: data/rbot/plugins/alias.rb:159
msgid ""
"alias list => list defined aliases | alias whatis <alias> => show definition "
"of the alias | alias remove <alias> => remove defined alias | see the "
diff --git a/po/zh_CN/rbot.po b/po/zh_CN/rbot.po
index 5d8b06d9..5a909ad1 100644
--- a/po/zh_CN/rbot.po
+++ b/po/zh_CN/rbot.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: rbot\n"
-"POT-Creation-Date: 2007-08-01 00:47-0400\n"
+"POT-Creation-Date: 2007-08-07 16:41-0400\n"
"PO-Revision-Date: 2007-07-09 01:39-0400\n"
"Last-Translator: Yaohan Chen <yaohan.chen@gmail.com>\n"
"Language-Team: Chinese\n"
@@ -838,47 +838,51 @@ msgid ""
"strategies"
msgstr ""
-#: data/rbot/plugins/alias.rb:55
+#: data/rbot/plugins/alias.rb:51
+msgid "Data file is not found or corrupt, reinitializing data"
+msgstr ""
+
+#: data/rbot/plugins/alias.rb:58
msgid "Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:71
+#: data/rbot/plugins/alias.rb:74
msgid "The definition you provided is invalid: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:82 data/rbot/plugins/alias.rb:99
+#: data/rbot/plugins/alias.rb:85 data/rbot/plugins/alias.rb:102
msgid "No such alias is defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:88
+#: data/rbot/plugins/alias.rb:91
msgid "No aliases defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:97
+#: data/rbot/plugins/alias.rb:100
msgid "Alias of %{command}"
msgstr ""
-#: data/rbot/plugins/alias.rb:109
+#: data/rbot/plugins/alias.rb:112
msgid ""
"The arguments in alias must match the substitutions in command, and vice "
"versa"
msgstr ""
-#: data/rbot/plugins/alias.rb:126
+#: data/rbot/plugins/alias.rb:129
msgid ""
"The alias seems to have caused infinite recursion. Please examine your alias "
"definitions"
msgstr ""
-#: data/rbot/plugins/alias.rb:142
+#: data/rbot/plugins/alias.rb:145
msgid "Error handling the alias, the command is not defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:152
+#: data/rbot/plugins/alias.rb:155
msgid "Create and use aliases for commands. Topics: create, commands"
msgstr ""
-#: data/rbot/plugins/alias.rb:154
+#: data/rbot/plugins/alias.rb:157
msgid ""
"\"alias <text> => <command>\" => add text as an alias of command. Text can "
"contain placeholders marked with : or * for :words and *multiword arguments. "
@@ -887,7 +891,7 @@ msgid ""
"google site:linuxbrit.co.uk/rbot/ <terms>"
msgstr ""
-#: data/rbot/plugins/alias.rb:156
+#: data/rbot/plugins/alias.rb:159
msgid ""
"alias list => list defined aliases | alias whatis <alias> => show definition "
"of the alias | alias remove <alias> => remove defined alias | see the "
diff --git a/po/zh_TW/rbot.po b/po/zh_TW/rbot.po
index 7854df53..11d8749c 100644
--- a/po/zh_TW/rbot.po
+++ b/po/zh_TW/rbot.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: rbot\n"
-"POT-Creation-Date: 2007-08-01 00:47-0400\n"
+"POT-Creation-Date: 2007-08-07 16:41-0400\n"
"PO-Revision-Date: 2007-07-09 01:24-0400\n"
"Last-Translator: Liang-Bin Hsueh <hlb@handlino.com>\n"
"Language-Team: Chinese\n"
@@ -847,47 +847,51 @@ msgid ""
"strategies"
msgstr ""
-#: data/rbot/plugins/alias.rb:55
+#: data/rbot/plugins/alias.rb:51
+msgid "Data file is not found or corrupt, reinitializing data"
+msgstr ""
+
+#: data/rbot/plugins/alias.rb:58
msgid "Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:71
+#: data/rbot/plugins/alias.rb:74
msgid "The definition you provided is invalid: %{reason}"
msgstr ""
-#: data/rbot/plugins/alias.rb:82 data/rbot/plugins/alias.rb:99
+#: data/rbot/plugins/alias.rb:85 data/rbot/plugins/alias.rb:102
msgid "No such alias is defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:88
+#: data/rbot/plugins/alias.rb:91
msgid "No aliases defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:97
+#: data/rbot/plugins/alias.rb:100
msgid "Alias of %{command}"
msgstr ""
-#: data/rbot/plugins/alias.rb:109
+#: data/rbot/plugins/alias.rb:112
msgid ""
"The arguments in alias must match the substitutions in command, and vice "
"versa"
msgstr ""
-#: data/rbot/plugins/alias.rb:126
+#: data/rbot/plugins/alias.rb:129
msgid ""
"The alias seems to have caused infinite recursion. Please examine your alias "
"definitions"
msgstr ""
-#: data/rbot/plugins/alias.rb:142
+#: data/rbot/plugins/alias.rb:145
msgid "Error handling the alias, the command is not defined"
msgstr ""
-#: data/rbot/plugins/alias.rb:152
+#: data/rbot/plugins/alias.rb:155
msgid "Create and use aliases for commands. Topics: create, commands"
msgstr ""
-#: data/rbot/plugins/alias.rb:154
+#: data/rbot/plugins/alias.rb:157
msgid ""
"\"alias <text> => <command>\" => add text as an alias of command. Text can "
"contain placeholders marked with : or * for :words and *multiword arguments. "
@@ -896,7 +900,7 @@ msgid ""
"google site:linuxbrit.co.uk/rbot/ <terms>"
msgstr ""
-#: data/rbot/plugins/alias.rb:156
+#: data/rbot/plugins/alias.rb:159
msgid ""
"alias list => list defined aliases | alias whatis <alias> => show definition "
"of the alias | alias remove <alias> => remove defined alias | see the "