You are here

function i18nstrings_update in Internationalization 6

Update / create translation source for user defined strings.

Parameters

$name: Textgroup and location glued with ':'.

$string: Source string in default language. Default language may or may not be English.

$format: Input format when the string is diplayed through input formats

13 calls to i18nstrings_update()
i18nblocks_locale_refresh in i18nblocks/i18nblocks.module
Refresh all strings.
i18nblocks_save in i18nblocks/i18nblocks.module
Set block language data.
i18ncck_locale_refresh in i18ncck/i18ncck.module
Refresh locale strings.
i18ncontent_locale_refresh in i18ncontent/i18ncontent.module
Refresh content type strings.
i18ncontent_node_type in i18ncontent/i18ncontent.module
Implementation of hook_node_type().

... See full list

File

i18nstrings/i18nstrings.module, line 1183
Internationalization (i18n) package - translatable strings.

Code

function i18nstrings_update($name, $string, $format = NULL) {
  $context = i18nstrings_context($name, $string, $format);
  $params = i18nstrings_params($context, $string);
  if (!i18nstrings_allowed_format($format)) {

    // This format is not allowed, so we remove the string, in this case we produce a warning
    drupal_set_message(t('The string %location for textgroup %textgroup is not allowed for translation because of its input format.', $params), 'warning');
    return i18nstrings_remove_string($context, $string);
  }
  $status = i18nstrings_update_string($context, $string, $format);

  // Log status message
  switch ($status) {
    case SAVED_UPDATED:
      watchdog('i18nstrings', 'Updated string %location for textgroup %textgroup: %string', $params);
      break;
    case SAVED_NEW:
      watchdog('i18nstrings', 'Created string %location for text group %textgroup: %string', $params);
      break;
  }
  return $status;
}