Customizing Built-in Strings in Drupal28 Sep 2011 in Drupal
At work, we had a situation where one of the strings built in to the Drupal User Interface made things somewhat confusing. By default, 'Enter your sitename username.' is displayed beneath the username box on the login form. However, we use a centralized authentication system called 'NetID', so this prompt was confusing to some users.
One of my coworkers had received the request from the user to change this text to "Please enter your KSU NetID." His first thought was to create a subtheme of our base theme and modify a .tpl.php. (It turns out this isn't even directly possible, you have to register a special .tpl.php handler first.) My first thought was hook_form_alter, but after a moment, I realized that was overkill for the task of changing a single string. I recalled that before we had used locale settings to modify strings being output, so I wondered if we couldn't do that here as well. The first step was to find the raw string, before any processing.
I grepped through user.module for "Enter your" and found that the string was 'Enter your @s username.' I then opened settings.php and went to the bottom, where there was an array that looked something like this:
# $conf['locale_custom_strings_en'] = array( # 'forum' => 'Discussion board', # '@count min' => '@count minutes', # );
To make the change we needed, I set it up as:
$conf['locale_custom_strings_en'] = array( 'Enter your @s username.' => 'Please enter your KSU NetID.', );
The same thing can be achieved on Drupal 7 in settings.php, but the format of the array has changed slightly:
# $conf['locale_custom_strings_en'][''] = array( # 'forum' => 'Discussion board', # '@count min' => '@count minutes', # );