Translating custom strings (i18nstrings wrapper)

Last updated on
30 April 2025

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.

Help improve this page

Page status: Not set

You can: