I'm a little unclear on the help description:
Places where %, @, or ! are used means that the translation contains dynamic information (such as the node type or title in the above examples), these are not translated while the text around them are.
As I read that, it seems to say that in this line of code...
$options[] = array(
'name' => t('Posts of type %type', array('%type' => node_get_types('name', $node->type))),
......I can replace "Posts of type" with "Any new"; however, that's not working. I can replace "Posts of type %type" with "Any new product", but that works with this string for all content types. (I'm overriding the Notifications module.)
Am I misreading the help text? Should I be able to replace just "Posts of type"?
Comments
Comment #1
mrtoner commentedWait a second, I think I figured it out. String Overrides needs me to define the entire string to look for -- in this case, "Posts of type %type." It won't do partial strings, right? And I can define the dynamic content in the replacement, right?
So, replacing "Posts of type %type" with "Any new %type" should work... and it does!
Comment #2
robloachYup! Has to be the whole string. If you have any helpful documentation or something could be stuck into hook_help, that would be cool. The documentation is pretty scarce.
Comment #3
mrtoner commentedI would only make a few minor changes and flesh out the examples:
The String Overrides module provides a quick and easy way of replacing text.
To replace a string, enter the complete string that is passed through the t() function. String Overrides cannot translate user-defined content, it can only replace strings wrapped in the t() function. To find the strings you can actually change, open up a module and look for t() function calls. Places where %, @, or ! are used means that the translation contains dynamic information (such as the node type or title in the above examples); <-- semicolon these are not translated while the text around them is.
For example:
Are you sure you want to delete %title?
can be replaced with
Do you want to delete %title?
or
%title will be deleted.
You can even leave out the dynamic content if you like:
This content will be deleted.
Remember, you must replace the entire string, not just a portion of it. For example:
Are you sure you want to delete %title?
can be replaced, but
Are you sure
cannot.
Comment #4
robloachThank you so much for writing this up! I'll stick it in hook_help sometime soon.
Comment #5
jrdixey commentedThanks for documenting this, mrtoner! I was trying to figure this exact thing out from the documentation on Friday, but my string replacements weren't working and I didn't know why. :)
Comment #6
robloachhttp://drupal.org/cvs?commit=172630