[support] Fwd: "Read more" edit

Shai Gluskin shai at content2zero.com
Tue Apr 12 02:19:08 UTC 2011


Christian,

What you are trying to do is really easy to do, once you know how to do it!
[?]

And you *don't* have to hack core.

The problem that you are having is that you have to override everything in
the particular t() function, not just part of it.

So finding the relavent line in core was extremely important... so that work
you did was not for naught. The line you found from core is as follows:

'title' => t('Read more<span class="element-invisible"> about
@title</span>', array('@title' => $node_title_stripped)),

The mistake you were making with the string overrides module is that the
part you have to override has to be all the text in the first argument of
the t() function. So in this case, you need specify the following as the
text you want to replace:

Read more<span class="element-invisible"> about @title</span>

Because most of the time I have to find the exact string inside Drupal core
or a contrib module in order to get the String Overrides module to work, I
instead never use that module but instead use Drupal core's built in way to
do this via editing the settings.php file (that is NOT hacking core).

Look for this part of the settings.php file around line 418:

# $conf['locale_custom_strings_en'][''] = array(
#   'forum'      => 'Discussion board',
#   '@count min' => '@count minutes',
# );

Change it to this, uncommenting the $conf variable and then adding your own
line, following the examples given to you there:

$conf['locale_custom_strings_en'][''] = array(
#   'forum'      => 'Discussion board',
#   '@count min' => '@count minutes',
    'Read more<span class="element-invisible"> about @title</span>' => 'See
full article',
 );

p.s. I don't have a clue what that <span class="element-invisible"> about
@title</span> is all about. That is new with D7. But it's not just this case
that more than just the visible string is added to a t() function. You
almost always have to find the original t() function and see what's there
before you can successfully override it.

best,

Shai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20110411/4e0ad694/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 96 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/support/attachments/20110411/4e0ad694/attachment.gif 


More information about the support mailing list