Error messages while installing the module
| Project: | abuse |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Ingumsky |
| Status: | needs review |
Here's the error messages I received after installing abuse.module both on my local machine and production site.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t($reason->reason) in abuse.admin.inc on line 175.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t('Reason edit '.$values['arid'].' saved') in abuse.admin.inc on line 304.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t($message,array('@name'=>$account->name)) in abuse.admin.inc on line 456.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t(variable_get('abuse_warn_body','')) in abuse.admin.inc on line 589.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t($title,array('!num'=>_abuse_get_tallied_count($type))) in abuse.module on line 525.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t($title,array('!assigned'=>$assigned,'!remaining'=>$remaining)) in abuse.module on line 531.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t($reason->reason) in abuse.module on line 608.
* abuse_perm() should have an array of literal string permission names. In abuse.module.
* The first parameter to t() should be a literal string. There should be no variables, concatenation, constants or other non-literal strings there. At t('Content gets flagged into a pending pile '.'(users can still view item) if a match is found in the watchlist. '.'Content gets flagged into hidden pile (hidden from users) if a match '.'is from from the bannedlist. Users will only be validated against banned words.') in watchlist/watchlist.module on line 165.
* watchlist_perm() should have an array of literal string permission names. In watchlist/watchlist.module.As I can see there're some errors with drupal semantics in your code. Some of those warnings I can (ok, I THINK I CAN) remove by fixing t() usages.
My solution is to replace some implementations with the new ones:
t($reason->reason) in abuse.admin.inc on line 175 -----> t('%reason', array('%reason' => $reason->reason))
t('Reason edit '.$values['arid'].' saved') in abuse.admin.inc on line 304 -----> t('Reason edit %arid saved', array('%arid' => $values['arid']))
t(variable_get('abuse_warn_body','')) in abuse.admin.inc on line 589 -----> t('%warn_body', array('%warn_body' => variable_get('abuse_warn_body','')))
t($reason->reason) in abuse.module on line 608 -----> t('%reason', array('%reason' => $reason->reason))
t('Content gets flagged into a pending pile '.'(users can still view item) if a match is found in the watchlist. '.'Content gets flagged into hidden pile (hidden from users) if a match '.'is from from the bannedlist. Users will only be validated against banned words.') in watchlist/watchlist.module on line 165 -----> t('Content gets flagged into a pending pile (users can still view item) if a match is found in the watchlist. Content gets flagged into hidden pile (hidden from users) if a match is from from the bannedlist. Users will only be validated against banned words.')
I'll provide patches for abuse.module, abuse.admin.inc, watchlist.module with those replacements but I still have no solution to fix t($message,array('@name'=>$account->name)) in abuse.admin.inc on line 456, t($title,array('!num'=>_abuse_get_tallied_count($type))) in abuse.module on line 525, t($title,array('!assigned'=>$assigned,'!remaining'=>$remaining)) in abuse.module on line 531, abuse_perm() in abuse.module and watchlist_perm() in watchlist/watchlist.module. Yes, i'm not a pro and can't fix those ones but hopefully my contribution helps other lads (or pretty girls ;) nevertheless.

#1
Here's three little patches I've promised. Try them please and give me some feedback.
#2
See the duplicate issue #406218: Check the t() functions for correct usage for some additional infos to fix this problem.