Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Stefan Nagtegaal’s picture

For cron.php, xmlrpc.php and index.php:
- "" -> '' where needed;

Stefan Nagtegaal’s picture

All modules use >em<string>/em<, only the aggregator-, blog-, filter-, and user.module uses >i<string>/i< to make italic text..
Attach patch fixes this..

We use >i<string>/i< inside the doxygen comments to, but I did not touch them.. Is there a reason why we do this? Or can Doxygen documentation generator handle >em<string>/em< also?

Stefan Nagtegaal’s picture

This patch superceeds the patch in post #1 where I used tabs instead of spaces :-$..
Number 2 and 3 still applies correctly and can be applied completely independent..

Dries’s picture

Committed, however the patch for conf.php failed to apply (malformed). Please resubmit that patch.

Stefan Nagtegaal’s picture

We should use a consistent form of drupal_set_message($message, $type) and form_set_error($name, $error) inside drupal. For example we use the following two ways of drupal_set_message:

drupal_set_message(t("error attaching file '%name': total file size exceeded", array('%name' => $file->filename)));

and

drupal_set_message(t("Error attaching file '%name': total file size exceeded", array('%name' => $file->filename)));

Notice the uppercase firstletter in the second drupal_set_message() example.. The story is exactly the same for the form_set_error()..

Attached patch fixes this behaviour and makes _all_ the drupal_set_message() and form_set_error() start with a capital letter everywhere..

Please review and apply...

Stefan Nagtegaal’s picture

A new patch for conf.php wich includes:
- improved helptext;
- "" -> '' where possible;
- used consistent code commenters like /**...*/ for the help texts;

Please review and apply...

JonBob’s picture

We need a consistent policy, and I agree that initial capitalization seems like the best one. These are complete sentences, and as such there seems no need to have the uncapitalized versions available.

Your example brings up a related style point. I'd instead use:

drupal_set_message(t('Error attaching file "%name": total file size exceeded.', array('%name' => $file->filename)));

Note double quote/single quote change. That's what this issue was originally about, right? :-) It's better English to use double quotes in human-readable text, and we use single quotes in PHP where practical. Also, I'd close the sentence with a period.

moshe weitzman’s picture

instead of quotes around a filename, i'd prefer italics or code tag. how about

drupal_set_message(t('Error attaching file %name: total file size exceeded.', array('%name' => "<code>$file->filename</a>")));
Dries’s picture

I committed Stefan's patch to HEAD. I'm not marking this 'fixed' yet, as the quote issue needs to be discussed further. I don't really care about the outcome as long we are being consistent. Also, I suggest we add the drupal_set_message() and drupal_form_error() guidelines to the Doxygen comments.

Stefan Nagtegaal’s picture

Moshe Weitzman said:
instead of quotes around a filename, i'd prefer italics or code tag.

I'd really like to agree with Moshe! Please, if someone does not feel comfortable with this approach or has anything else against this, please reply.. A patch for such an approach is on it's way...

Stefan Nagtegaal’s picture

Allright! Attached patch makes watchdog(), drupal_set_message() and form_set_error() consistent in drupal.

- all messages of the mentioned functional start with a capital letter;
- all messages end with a '.' (dot);
- edited some texts to get rid of escaped single quotes;
- removed HTML-tags outside the translatable area's;
- added some more t()'s around forgotten strtr()-ed watchdog-messages inside locale.module;
- important sentences inside the strings are using the <em>important</em> tag, to give a more consistent look;
- using single quotes where this was possible, but tried to avoid escaping them.. Example:

- watchdog('error', t('Translation file "<em>%a</em>" couldn\'t be opened.', array('%a' => $file->name)));
+ watchdog('error', t("Translation file %filename couldn't be opened.", array('%filename' => "<em>$file->name</em>")));

When we use this form of writing consistently, the extraction script will become more and more handy and userfriendlyness because we can simply extract _all_ translatable strings/text from drupal without having extra '\'s..

If this patch hits core, I'll update the help-texts of all modules to keep this kind of unescaped help texts and strings consistent..

I think this would be a great improvement, code- and usability wise..

Please review attached patch and apply..

Steven’s picture

I noticed a couple of odd things:
- You use ucfirst() on translatable strings. We avoid ucfirst() because it is not UTF-8 compatible.
- You seem to have no consistent rule for capitalizing the first word after a colon (:). I'm no expert, but I think the rule is to not capitalize in that case.

Stefan Nagtegaal’s picture

FileSize
6.01 KB

The first patch for the upload.module;
- using '' instead of "";
- using form_set_error() instead of drupal_set_message();
- commented out debug code;
- removed theme_attached_files() because it wasn't used; (Will come back later)
- made the headers of the tables use lowercase characters as we do in the rest of drupal;

Stefan Nagtegaal’s picture

Together with the patch in #13, drupal uses drupal_set_message(), form_set_error() and watchdog() in the same consistent way..

Please review and apply both patches...

Dries’s picture

Committed. Thanks. The patch for conf.php is malformed.

Also, I suggest we use Doxygen to document the prefered style.

Stefan Nagtegaal’s picture

This patch makes all headers inside the theme('table') look consistent. Now all headers start with a Capital letter.

Dries’s picture

Committed to HEAD. Consistency is important. Thanks!

Stefan Nagtegaal’s picture

In locale.inc we find another inconsistency. Attched one-line patch fixes this.

Stefan Nagtegaal’s picture

Setting to patch again, so everybody notice 'Patch Attached!'.

Stefan Nagtegaal’s picture

Patch also for the block.module.

Please review and apply..

Stefan Nagtegaal’s picture

Another inconsistent operation in the path.module.

Steven’s picture

I applied the locale.inc patch, but not the other 2.

They refer to page titles, not links in tables. For clarity they should keep their name (like we do elsewhere). In fact, in the case of the path.module, the two titles are not used anywhere, because one is overridden, and the other drupal_goto's to another page.

Anonymous’s picture