Posted by TheRec on May 13, 2009 at 8:53pm
Jump to:
| Project: | Content Management Filter |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | TheRec |
| Status: | closed (fixed) |
Issue Summary
Hello,
Error issued by potx module when extracting translatable string for CMF.
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($string,array('%a'=>$filters[$type]['title'],'%b'=>$value)) in cmf.module on line 185. Read more at http://drupal.org/node/322732
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($string,array('%a'=>$filters[$type]['title'],'%b'=>$value)) in cmf.module on line 191. Read more at http://drupal.org/node/322732This leads to this patch with simply reuse the code in /module/node/node.admin.inc. I removed the useless condition which was also using some variable named $true and was not set anywhere in the script (which is somewhat a good thing, I wouldn't call this a good variable name :)) and in the end both branches of this condition were doing exactly the same thing... most likely something left out after tests, so I figured why not remove it.
I also modified the hook_help, where the help text was split on multiple lines which produced useless strings in the locale tables. Ah and I also put these strings in double quotes to avoid useless string caused by the escaped single quote (It\'s an ...) and made the string different than the one retrieved in the module .info file
Those bugs appeared to me while trying to build a French translation for the CMF module, which I will post when the above issues are commited.
| Attachment | Size |
|---|---|
| cmf-no_var_in_translation.patch | 2.56 KB |
Comments
#1
My bad, the escaped single quote wasn't causing any useless string in locale (this sentence is not present in .info). Anyways I feel it is a better approach when passing a string with single quotes through t(). If it is strongly against your coding standards, we can always change this again...but the multiple lines really produce useless strings in locale tables.
#2
#3
$true is passed as a parameter to the function. It probably should be something more like "$user_prof" according to the comments.
#4
Help change: See patch in #517880-1: Coding standards
#5
What is wrong with the patch is supplied ? I remember testing it and it was working and there was not more warning from potx ;)
#6
I understand. However, you delete the test for $true, which is a parameter passed in the call to the function.
#7
My apologies, after closer examination you are correct.
This is also included in #517880: Coding standards.
#8
Committed to both -dev versions. Thanks for the patch.
#9
Included in new release.