Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For translating custom strings (intervals, subscription names, etc...) we've implemented a wrapper function that uses i18nstrings if available.
The function looks like this:
/**
* Wrapper function for i18nstrings() if i18nstrings enabled.
*
* @param $name
* Name of the string, like "send_interval:$key:name"
* @param $string
* String in default language
* @param $langcode
* Optional language code to translate to, if not current page language
* @param $textgroup
* Text group name for the string. It defaults to 'notifications' for this module
*/
function notifications_translate($name, $string, $langcode = NULL, $textgroup = 'notifications') {
return function_exists('i18nstrings') ? i18nstrings($textgroup . ':' . $name, $string, $langcode) : $string;
}
About the UI for translation, see: Translating user defined strings.
Comments
Would it not be more generic
Would it not be more generic to write this as:
or even:
---
Work: BioRAFT
Changing Strings Alternative
Another option is using the String Overrides module. This module allows the admin to change the Subscribe/Unsubscribe links text.
For example, override of: "Posts of type @type" >> "New @types" will change the original link text from: "Subscribe to: Posts of type Event" to: "Subscribe to: New Events".