Capitalize menu, link, etc. titles throughout core.

webchick - September 14, 2006 - 16:27
Project:Drupal
Version:x.y.z
Component:base system
Category:task
Priority:normal
Assigned:Unassigned
Status:closed
Description

There is currently a huge, monster thread on the development list @ http://lists.drupal.org/archives/development/2006-09/msg00280.html. Here's a summary which should save you a few hours of your life: ;)

1. Drupal's lowercasing of everything brings about inconsistencies in various places, for example the breadcrumbs for forums: home >> forums >> My Super Forum.

2. You have some flexibility at the theme layer to change this. You Can Use CSS to Capitalize The First Letter Of Each Word. OR CONVERT IT TO UPPERCASE. Or only the first letter. or make it all lowercase.

3. But what you can't do is: Capitalize the First Letter of Each Word, Leaving Articles Lowercased. You need server-side logic to do this (does the word match this list of words that should be lowercased in a title? is the word the first word of the title? if it is, leave it capitalized, otherwise lowercase it.) and running this on every menu/link output on every page load by Drupal comes at a performance cost.

Therefore, this patch goes through node and system modules to Proper Case Titles, except for things like "Date and Time." One big patch should be rolled against core with all the capitalization changes, which I don't have time to do (and other people committed to this already), but here is a patch to get us started anyway.

AttachmentSize
capitalize.patch17.66 KB

#1

rkerr - September 14, 2006 - 18:00

I think this is for sure the correct thing to do... tracking this issue :)

#2

drewish - September 14, 2006 - 18:09

subscribing

#3

webchick - September 14, 2006 - 18:11

Guys. ;) How about instead of subscribing, you each take a module or two? ;) Then this will actually get done much faster and we'll gave something to get committed. ;)

#4

drewish - September 14, 2006 - 18:13

oh, i intend to, this way i can find the link when i've got a litte time to work on it.

#5

webchick - September 14, 2006 - 18:25

Ah, good stuff. :) thanks!

#6

magico - September 14, 2006 - 18:45

(subscribe)

#7

Gary Feldman - September 14, 2006 - 18:53

It took me some time to figure out what you meant by "Date and Time" (and that your point had nothing to do with either dates or times in titles).

So let me be more explicit, by rewording the rule in the last paragraph at http://www.writers.com/tips_titles.html:

The words "a, an, the, at, by, for, in, of, on, to, up, and, as, but, it, or, and nor" should be in lower case, unless they're the first word in the title. All other words should be capitalized, regardless of where they appear in the title.

There are other conventions, as indicated at that link above. I don't think anyone will complain if someone happens to follow the Chicago Manual of Style or AP or whatever, nor should they, but this explicit list of words seems like the simplest rule to have here.

#8

drewish - September 14, 2006 - 22:07

Here's one for the watchdog module.

AttachmentSize
capitalized_watchdog.module.patch 2.84 KB

#9

adixon - September 15, 2006 - 15:42

As someone noted in the list discussion, this also means all the translations have to be edited (since translations are case sensitive). So when you do a module, also do the .po files.

#10

drewish - September 15, 2006 - 16:22

I think it'd make sense to just roll up all the .po files at the end wouldn't it?

#11

webchick - September 15, 2006 - 16:55

agreed. it's tedious enough just doing the text. :P one thing at a time.

#12

Wesley Tanaka - September 17, 2006 - 02:47

http://drupal.org/node/53753 was marked as a duplicate of this.

subscribing.

Is it just me or does a mega patch seem like it has little chance of ever getting committed? Would it be better to commit patches as they came in?

#13

webchick - September 17, 2006 - 02:51

On the dev list, Drumm and/or Dries (sorry, can't remember who) said it all needs to go at once. This makes sense, as otherwise we have totally inconsistent capitalization throughout core.

#14

moshe weitzman - September 18, 2006 - 16:46

@Wesley - this patch has very little chance of ever getting written (properly, as one consistent patch). If it did, I am pretty sure it would be committed.

#15

RobRoy - September 19, 2006 - 22:25

So we also want to get at all the fieldset and field #titles correct? So on the user edit page it will be...

Account Information
E-mail Address
Comment Settings
etc.

Just making sure. I'm 100% behind this patch. So the battle plan is to have one patch per file? So one patch for user.module, another patch for node.module, etc.? I'd like to know who is working on what so I know where to concentrate my efforts. Thanks webchick for taking charge!

#16

webchick - September 20, 2006 - 00:29

@RobRoy: the end patch needs to be one huge patch for all of core, but it's much easier to work on individual parts. So go ahead and roll one patch for user.module, etc. I (or whoever) can roll all the patches into one at the end.

Not sure about fieldsets and whatnot... the only thing we'd discussed on the dev ML was menu titles, so I guess keep it to that for now, and we can talk about other stuff in a separate patch.

#17

flk - September 20, 2006 - 17:43

capitalised aggregator modules menu links

there were 2 occassions where the title was
[code]
'title' => $category['title'],
[/code]

I just left those alone.

AttachmentSize
capitalise.aggregator.patch 6.27 KB

#18

flk - September 28, 2006 - 14:30

block.module menu capitalised.

i dont think there is a need to capitalise the theme names (only thing we can really control from block.module is the name of bluemarine) which are sub menu's thus i left them alone.

AttachmentSize
capitalise_block.patch 2.04 KB

#19

flk - September 28, 2006 - 14:35

blog.module

AttachmentSize
capitalise_blog.patch 1.09 KB

#20

flk - September 28, 2006 - 14:42

blogapi.module

AttachmentSize
capitalise_blogapi.patch 762 bytes

#21

flk - September 28, 2006 - 14:43

book.module

AttachmentSize
capitalise_book.patch 1.36 KB

#22

Zen - September 28, 2006 - 17:07

Correct / Easy on the eyes / Uncomplicated / Reads like a sentence:

"This is a Drupal title and reads like any other sentence"

Examples:
http://news.bbc.co.uk/
http://www.lemonde.fr/
http://hinduonnet.com/
http://www.torontosun.com/
http://www.theage.com.au/
http://www.iht.com/
http://www.elpais.es/

Incorrect / Overcomplicated / Tough on the eyes / A touch of Yanqui sensationalism :P :

"This is a Drupal Title and is Likely to Give You a Heart Attack"

Examples:
http://www.washingtonpost.com/
http://nytimes.com/

http://cnn.com appears to sit on the fence on this one.

My 0.10p,
-K

#23

flk - September 28, 2006 - 17:10

just an update

So far the following modules have been 'capitalised' :

aggregator.module
block.module
blog.module
blogapi.module
book.module
comment.module
contact.module
drupal.module
filter.module
forum.module
help.module
legacy.module
locale.module
menu.module
node.module
system.module
watchdog.module

for convenience sake i have combined the patches submitted so far into one big patch...please review those.

So for now that leaves the following modules which need to be capitalised (capitalisation of _menu):

path.module
ping.module
poll.module
profile.module
search.module
statistics.module
taxonomy.module
throttle.module
tracker.module
upload.module
user.module

so grab one and dig in :D

AttachmentSize
capitalise_combine.patch 55.58 KB

#24

flk - October 3, 2006 - 15:40

ok i think thats it for the last of the modules....

AttachmentSize
capitalise_combine_0.patch 27.01 KB

#25

flk - October 3, 2006 - 15:54
Status:needs work» needs review

combined everything together...please review

AttachmentSize
capitalise_combine_1.patch 83.8 KB

#26

Stefan Nagtegaal - October 3, 2006 - 17:01
Status:needs review» reviewed & tested by the community

Simple and straightforward. Applied clean to CVS without any problems..
This is ready, so let's get this in...

#27

webchick - October 3, 2006 - 17:51
Status:reviewed & tested by the community» needs work

Awesome job, Shakur!!

However, there's one problem: the capitalization of the menu titles in the help text is now inconsitent; it's done in watchdog, but not in others. I'd recommend removing those portions of the patch and either make the help text fixes a separate one, or removing those links altogether frrom help if http://drupal.org/node/84414 makes it in.

#28

flk - October 3, 2006 - 22:52
Status:needs work» needs review

ok, removed the _help msgs of watchdog and rerolled everything against head.

AttachmentSize
capitalise_combine_2.patch 84.27 KB

#29

webchick - October 3, 2006 - 23:03

To address Zen's comments in #22:

1. Switching titles to be "This is a title" is inconsistent with core's usage of US English throughout. You'll notice that the sites you've cited are from Canada, UK, Australia, etc.
2. You can't programmatically re-create "Date and Time" without a lot of server-side processing.
3. You can, using only CSS, re-create all other formatting options such as "this is a title" and "This is a title" and "THIS IS A TITLE"

therefore, this way seems the way to go.

#30

flk - October 3, 2006 - 23:39

hmm some people having problem using the patch. rerolled.

AttachmentSize
capitalise_combine_3.patch 82.61 KB

#31

AjK - October 3, 2006 - 23:55
Status:needs review» needs work

http://drupal.org/node/84414 introduced a By Module tab into admin and that seems overlooked by this patch. Flk did ask me to reroll but he's off to bed and, well, I'm in the same timezone as he! Me off to bed too!

#32

RobRoy - October 4, 2006 - 00:18
Status:needs work» needs review

Here's a re-roll for HEAD but it looks like that By Module is already taken care of.

AttachmentSize
capitalise_combine_4.patch 81.53 KB

#33

Zen - October 4, 2006 - 06:14
Status:needs review» needs work

1. Switching titles to be "This is a title" is inconsistent with core's usage of US English throughout. You'll notice that the sites you've cited are from Canada, UK, Australia, etc.

http://bostonherald.com/
http://www.boston.com/ [Boston globe]
http://sfgate.com/chronicle/
http://www.chicagotribune.com/

This doesn't appear to be something all American papers do.. It looks to be about 50/50. In other words, this is not a "locale" issue. It is an issue of readability, simplicity, elegance and ease of use.

Also, el jefe has an opinion on this as well.

-K

#34

webchick - October 4, 2006 - 06:41
Status:needs work» needs review

Please leave this for review. You've stated your opinion, that doesn't necessarily mean the patch needs work. We'll let one of the core committers chime in on which method they'd like to see and adjust the patch accordingly if need be.

PS: Yeah I know Dries said that, but it was early on in the conversation and before the discussion about the impossibility of fixing with CSS, etc. If he still feels that way, then that's cool with me.

#35

AjK - October 4, 2006 - 07:17

Patch in #32 fails to apply for the same reason patch in #28 fails to apply. All line ends have the Windows end of line character (^M) appended.

#36

webchick - October 4, 2006 - 07:23

Using a utility like dos2unix should convert the line breaks in the patch for you. Otherwise, update your version of patch. patch 2.5.8 on OS X is working fine for me.

#37

AjK - October 4, 2006 - 18:59

Patch in #32 applied ok (after stripping ^M line ends). All seems well but I can't help an enourmous sense of "extended camel case" in the new admin/ by modules page. What do I mean, well, be exmaple:-

    * configure permissions
    * Access Log Settings
    * Recent Hits
    * Top Pages
    * Top Referrers
    * Top Visitors
    * get help

Why is configure permissions and get help always lower case? What's so special about Pages or Referrers that give them a capital but neither the former? The whole page looks "unbalanced". That's what I meant in my previous comment about this page, obviously didn't make myself clear.

@webchick Yep, I know about dos2unix. In fact, my Windows text editor of choice (EditPad Pro) is set to always save in Unix format. On patches that I fetch which turn out to have ^M endings I use vi :1,$! tr -d '\015' to remove the ^M. The only reason I point this out is that the Drupal handbook for HOWTO: Submit patches for Drupal is aimed at the patch maker and not at the committer (and by proxy any intermediate patch reviewer). Pointing it out is just to remind patch makers they need to make this step, not the reviewer/committer.

AttachmentSize
capitalise_combine_4_0.patch 79.82 KB

#38

RobRoy - October 4, 2006 - 22:37

Okay, in this patch I think I've...

- Fixed a few stragglers like get help, configure perms, log in, etc.
- Changed my doc type to Unix. Let me know if you find the ^M's in this patch.

AttachmentSize
capitalise_combine_5.patch 80.46 KB

#39

AjK - October 5, 2006 - 07:53
Status:needs review» needs work

RobRoy,

Looks good. I'm assuming that the column Name in admin/build/modules is derived from the modules themselves and are therefore up to module maintainers to get correct.

Some more "stragglers":-

Under Navigation >> Create Content :-

# Create Content
* forum topic
* page
* Poll
* story

Poll ok but the others not, likewise on the main page itself except here it's poll so they all wrong?

regards,
--AjK

#40

RobRoy - October 5, 2006 - 18:43
Status:needs work» needs review

Fixed the above. 'page' and 'story' are done in system_install() so you'll have to reinstall Drupal to see those change.

AttachmentSize
capitalise_combine_6.patch 82.69 KB

#41

RobRoy - October 9, 2006 - 02:35

Keeping up with HEAD. I also found that Search and Search Settings were mixed up, fixed that.

Can we get a big boy/girl to check this out? Looks good to me.

AttachmentSize
capitalise_combine_7.patch 82.83 KB

#42

flk - October 9, 2006 - 23:31
Status:needs review» reviewed & tested by the community

looking good guys.

reviewed it and works fine with head.

#43

Dries - October 10, 2006 - 08:35

Looks good. Some hunks failed to apply though. Also, what is the guideline with regard to form titles? I'd like to see some written guidelines that can be posted as soon this patch gets committed.

#44

flk - October 10, 2006 - 16:02

rolled against head.

AttachmentSize
capitalise_combine_8.patch 85.69 KB

#45

webchick - October 10, 2006 - 18:27

Written guidelines, which could be added to the updating modules docs:

Menu titles capitalized

All menu titles within Drupal and its modules should be capitalized according to U.S. English. All words in the title should be capitalized, apart from articles, prepositions, and conjunctions.

For example, a title such as 'edit category' should now be 'Edit Category' and 'date and time' should now be 'Date and Time.'

Here is an example of old code:

<?php
function story_menu($may_cache) {
 
$items = array();

  if (
$may_cache) {
   
$items[] = array('path' => 'node/add/story', 'title' => t('story'),
     
'access' => user_access('create stories'));
  }

  return
$items;
}
?>

Here is an exaple of new code:

<?php
function story_menu($may_cache) {
 
$items = array();

  if (
$may_cache) {
   
$items[] = array('path' => 'node/add/story', 'title' => t('Story'),
     
'access' => user_access('create stories'));
  }

  return
$items;
}
?>

(note that the title "Story" has been captalized)

If you wish to use different capitalization rules on your site's menu items, you may use CSS in your theme."

If someone could create some examples of how to change the capitalization rules in CSS that would be a nice thing to add to this. I'm not much of a CSS person.

#46

RobRoy - October 10, 2006 - 18:38

@webchick: Regarding Dries' request for guidelines for form titles (both fields and fieldset titles), do you think all form fields/fieldset titles should follow the same rules as menu items? As it is now, they are all first letter capitalized and the rest lowercase (like Project information, New comment, File attachment, etc.). Thoughts?

#47

Dries - October 10, 2006 - 20:19

Btw, I still think that 'Edit category' is much more elegant than 'Edit Category'.

#48

Dries - October 10, 2006 - 20:21

Read: I want it to read 'Edit category' (even if that means we have to use CSS for that).

#49

RobRoy - October 10, 2006 - 20:27

I agree with Dries on that, but now we can do it all with CSS for menu items at least.

For form titles, I think Capitalizing Each Form Title Would Look Pretty Bad and think we could stick to the current scheme. In other words, it isn't as pressing to change all the form titles from 'Form title' to 'Form Title' since they look alright like that and are a little more consistent with the menu items (as opposed to the all lowercase menu items).

#50

RobRoy - October 10, 2006 - 20:31

Hmmm...but something just came up. If we're going to use CSS to make 'Menu Item Link' turn into 'Menu item link' then we'd need to use the same CSS to perform that change of case to the breadcrumb, page title, etc. But what about breadcrumb titles, page titles that we don't want to go lowercase or that have Proper Nouns in them or acronyms like RSS?

#51

webchick - October 10, 2006 - 23:40

D'oh! I misunderstood.

I agree that it should remain "Sentence capialization" for form fields and such. Only menu items and page titles (which are derived from menu items) should be "Proper Case Capitalized," imo.

But you're right about "RSS Aggregator"=> "Rss aggregator" with "sentence capitalization" CSS. I'm not aware of a great solution around this, apart from introducing some PHP logic. I guess we need to make a judgment call about which is harder to do... server-side logic to uncapitalize "the, and, a, for..." or server-side logic to keep capitalized "RSS, OPML..."

Zen's made the case for U.S. news sources using "Sentence type capitalization" and this is what Dries prefers, too. Grammar geeks cringe when they see it. I'm a grammar geek, but could go either way, since we have an international audience and "Sentence type capitalization" is used more often throughout the world.

But basically, we have to pick one. And people who want it a different way are going to have to do some work.

Or, we could just leave it all lowercase which ticks everyone off. ;)

#52

magico - October 11, 2006 - 10:47

Is much easier to use server-side logic to capitalize "RSS, OPML, etc" than to uncapitalize other words.

The reason is simple: the only words that will be fully capitalized are acronyms. So it is easy (and much more correct) if all acronyms within drupal would be inside an acronym tag, that would be styled as needed.

#53

Dries - October 11, 2006 - 12:02

I agree that it should remain "Sentence capialization" for form fields and such. Only menu items and page titles (which are derived from menu items) should be "Proper Case Capitalized," imo.

For me, both menu titles and form titles should consistently use "Sentence capialization".

#54

webchick - October 11, 2006 - 14:01

magico: Oh, good call! Then we could even just use CSS to capitalize those!

Dries: So that's your final answer? :) Ok, I'll try and go through later and re-work the patch to use sentence capitalization, if Shakur doesn't beat me to it. ;)

#55

RobRoy - October 11, 2006 - 17:33

@webchick: So the final answer from Dries is "Sentence capitalization" for form titles and fieldset titles, but we are still sticking with "Proper Case Capitalized" for menu items. Just making sure that was clear. I think the bulk of this patch (if not all) is covering menu items so there shouldn't be much to change, right?

#56

RobRoy - October 11, 2006 - 17:34

I'm an idiot, completely disregard my last comment.

#57

webchick - October 11, 2006 - 17:52

Btw, we can't use <abbr> ... check_plain around menu titles. Nice idea anyway though. :)

#58

RobRoy - October 11, 2006 - 17:56

@Dries, what's the word on hook_link()s? Should we change those to sentence as well? For example, "Add new comment", etc. so they are consistent?

#59

Dries - October 12, 2006 - 15:08

I'm OK with updating links to, as long we add it to the guidelines and as long we use sentence capitalization.

#60

flk - October 12, 2006 - 17:30

hmmm i am bit confused now...
we can do hook_link etc in another patch...but what more is need for this patch to get in?

#61

RobRoy - October 12, 2006 - 18:02

Shakur, we need to change all "Capitalized Menu Items" to "Capitalized menu items". I've already started this and will take another stab at finishing it later today if I can. I've already started doing the hook_link()s in the same patch as I'm just searching for 'title' => and it's easier. Should I separate them out you think?

#62

webchick - October 12, 2006 - 18:21

If it's just a find/replace, go ahead and do them all in one go, imo.

#63

RobRoy - October 13, 2006 - 02:08
Status:reviewed & tested by the community» needs review

Okay, here is the whole patch with "Sentence capitalization" for menu titles, links, etc. I think I got them all but would appreciate someone else's eyes on this.

AttachmentSize
sent_capitalise_combine.patch 86.74 KB

#64

profix898 - October 19, 2006 - 07:31
Status:needs review» needs work

The patch does no longer apply cleanly.
And shouldnt we wrap the content type menu titles (e.g. node.module line 1071/1129) in 'title' => drupal_ucfirst(t($type->name)) to make sure these titles fit into the capitalization schema?

#65

RobRoy - October 19, 2006 - 17:32
Status:needs work» needs review

Here is a re-rolled patch. Regarding content types, new content types will be renamed in their respective modules. This patch covers core content types though.

Can we get a higher up (i.e. Dries) to check this out? Should be what he requested above. Thanks!

AttachmentSize
capitalise_combine_9.patch 64.29 KB

#66

RobRoy - October 19, 2006 - 17:34
Status:needs review» needs work

Hold off, bad patch. Arg...gimme one sec.

#67

RobRoy - October 19, 2006 - 17:40
Status:needs work» needs review

Here we go.

AttachmentSize
capitalise_combine_10.patch 86.75 KB

#68

Steven - October 22, 2006 - 08:18
Status:needs review» fixed

Personally I think the "Sentence capitalization" for menu and page titles looks rather ugly. But it's better than lowercase :P.

The last patch was missing node and user module too. I fixed that.

Committed to HEAD.

#69

webernet - October 22, 2006 - 14:44
Status:fixed» needs review

Missed a few in node.module...

AttachmentSize
patch_37.txt 2.7 KB

#70

profix898 - October 22, 2006 - 15:10

... some more in node.module and one in user.module ...

AttachmentSize
capitalise.patch 4.18 KB

#71

moshe weitzman - October 23, 2006 - 01:17

please document this in the upgrade guide - http://drupal.org/node/64279

#72

webchick - October 23, 2006 - 20:04
Status:needs review» reviewed & tested by the community

Looks good.

#73

Dries - October 23, 2006 - 20:45
Status:reviewed & tested by the community» needs work

Committed. Marking as 'code needs work' until this is documented. See Moshe's request.

#74

RobRoy - October 24, 2006 - 00:37
Status:needs work» fixed

Done at http://drupal.org/node/64279#sentence_capitalization.

Sorry about that re-roll, I thought the second one I put up re-included the node/user stuff. Oh, well! :P

#75

RobRoy - October 25, 2006 - 18:34
Status:fixed» needs review

One more minor thing, I don't think we should be doing a drupal_ucfirst() on the node type name. These types are now being defined in "Sentence capitalization" so they will come in correctly and don't need to be forced. This is documented in the aforementioned handbook page.

AttachmentSize
no_ucfirst.patch 697 bytes

#76

RobRoy - October 25, 2006 - 18:37

Too hasty as usual. Found another spot where there was a ucfirst but no t() around node type. Fixed that too.

Not sure about t() around node type name, but it was already there in the first spot so I just made it consistent. Should we remove those t()s?

AttachmentSize
no_ucfirst_0.patch 1.35 KB

#77

Steven - October 26, 2006 - 04:29

I think this is when are using the internal node type identifier (e.g. forum) instead of the human-readable name "Forum topic". The $node->type should not be presented in the UI and never t()'d.

It seems to me this is because the module .info API is somewhat broken, as there is no easy way to retrieve a single info field for a module, without using module_rebuild_cache(). That's too heavy and potentially even destructive to call at random times IMO.

#78

RobRoy - October 26, 2006 - 18:44

Okay, in that last patch I only have t() around the node type name, not the node type type so I think it's okay. Do you agree?

#79

RobRoy - November 3, 2006 - 21:47

Some capitalization stuff got reverted in user.module. Here is a simlple patch to fix it.

AttachmentSize
user_cap.patch 1.26 KB

#80

chx - November 3, 2006 - 21:50
Status:needs review» reviewed & tested by the community

Applies. 'Works' as intended -- no code change.

#81

RobRoy - November 3, 2006 - 22:06
Status:reviewed & tested by the community» needs review

Added that 'page' and 'story' type names are capitalized in system_install()... it was only in the update_X() before.

AttachmentSize
capitalise_combine_11.patch 3.59 KB

#82

chx - November 6, 2006 - 01:55
Status:needs review» reviewed & tested by the community

#83

Dries - November 7, 2006 - 12:03

Committed to CVS HEAD. Thanks.

#84

Dries - November 7, 2006 - 12:12
Status:reviewed & tested by the community» fixed

#85

Anonymous - November 21, 2006 - 12:16
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.