Translatable rule errors

pull/189/head
M66B 4 years ago
parent b42d6bbb84
commit 1fad28dd6a

@ -371,12 +371,12 @@ public class EntityRule {
case TYPE_KEYWORD: case TYPE_KEYWORD:
String keyword = jargs.getString("keyword"); String keyword = jargs.getString("keyword");
if (TextUtils.isEmpty(keyword)) if (TextUtils.isEmpty(keyword))
throw new IllegalArgumentException("Keyword missing"); throw new IllegalArgumentException(context.getString(R.string.title_rule_keyword_missing));
case TYPE_MOVE: case TYPE_MOVE:
case TYPE_COPY: case TYPE_COPY:
long target = jargs.optLong("target", -1); long target = jargs.optLong("target", -1);
if (target < 0) if (target < 0)
throw new IllegalArgumentException("Folder missing"); throw new IllegalArgumentException(context.getString(R.string.title_rule_folder_missing));
EntityFolder folder = db.folder().getFolder(target); EntityFolder folder = db.folder().getFolder(target);
if (folder == null) if (folder == null)
throw new IllegalArgumentException("Folder not found"); throw new IllegalArgumentException("Folder not found");
@ -384,14 +384,14 @@ public class EntityRule {
case TYPE_ANSWER: case TYPE_ANSWER:
long iid = jargs.optLong("identity", -1); long iid = jargs.optLong("identity", -1);
if (iid < 0) if (iid < 0)
throw new IllegalArgumentException("Identity missing"); throw new IllegalArgumentException(context.getString(R.string.title_rule_identity_missing));
EntityIdentity identity = db.identity().getIdentity(iid); EntityIdentity identity = db.identity().getIdentity(iid);
if (identity == null) if (identity == null)
throw new IllegalArgumentException("Identity not found"); throw new IllegalArgumentException("Identity not found");
long aid = jargs.optLong("answer", -1); long aid = jargs.optLong("answer", -1);
if (aid < 0) if (aid < 0)
throw new IllegalArgumentException("Answer missing"); throw new IllegalArgumentException(context.getString(R.string.title_rule_answer_missing));
EntityAnswer answer = db.answer().getAnswer(aid); EntityAnswer answer = db.answer().getAnswer(aid);
if (answer == null) if (answer == null)
throw new IllegalArgumentException("Answer not found"); throw new IllegalArgumentException("Answer not found");

@ -1194,6 +1194,10 @@
<string name="title_rule_answer_remark">Only one reply will be sent for any conversation, to avoid reply loops</string> <string name="title_rule_answer_remark">Only one reply will be sent for any conversation, to avoid reply loops</string>
<string name="title_rule_name_missing">Rule name missing</string> <string name="title_rule_name_missing">Rule name missing</string>
<string name="title_rule_condition_missing">Condition missing</string> <string name="title_rule_condition_missing">Condition missing</string>
<string name="title_rule_folder_missing">Folder missing</string>
<string name="title_rule_identity_missing">Identity missing</string>
<string name="title_rule_answer_missing">Template missing</string>
<string name="title_rule_keyword_missing">Keyword missing</string>
<string name="title_rule_automation_hint">This will send the intent \'%1$s\' with the extras \'%2$s\'</string> <string name="title_rule_automation_hint">This will send the intent \'%1$s\' with the extras \'%2$s\'</string>
<string name="title_rule_execute">Execute now</string> <string name="title_rule_execute">Execute now</string>

Loading…
Cancel
Save