i18n_string.variable.inc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @file
  4. * Variable information
  5. */
  6. /**
  7. * Implements hook_variable_info().
  8. */
  9. function i18n_string_variable_info($options = array()) {
  10. $variables['i18n_string_translate_langcode_[language]'] = array(
  11. 'type' => 'multiple_language',
  12. 'title' => t('Enable translation for language'),
  13. 'multiple values' => array('type' => 'boolean'),
  14. 'group' => 'i18n',
  15. );
  16. $variables['i18n_string_allowed_formats'] = array(
  17. 'title' => t('Translatable text formats'),
  18. 'options callback' => 'i18n_string_variable_format_list',
  19. 'type' => 'options',
  20. 'default callback' => 'i18n_string_variable_format_default',
  21. 'access' => 'administer filters',
  22. 'description' => t('The translation system only translates strings with the selected text formats. All other strings will be ignored and removed from the list of translatable strings.'),
  23. );
  24. $variables['i18n_string_source_language'] = array(
  25. 'title' => t('Source language'),
  26. 'type' => 'language',
  27. 'default callback' => 'i18n_string_source_language',
  28. 'description' => t('Language that will be used as the source language for string translations. The default is the site default language.'),
  29. );
  30. $variables['i18n_string_debug'] = array(
  31. 'type' => 'enable',
  32. 'title' => t('Debug string translation', array(), $options),
  33. 'default' => 0,
  34. 'group' => 'debug',
  35. );
  36. return $variables;
  37. }
  38. /**
  39. * Options callback, format list
  40. */
  41. function i18n_string_variable_format_list() {
  42. $list = array();
  43. // As the user has administer filters permissions we get a full list here
  44. foreach (filter_formats() as $fid => $format) {
  45. $list[$fid] = $format->name;
  46. }
  47. return $list;
  48. }
  49. /**
  50. * Allowed formats default value
  51. */
  52. function i18n_string_variable_format_default() {
  53. return array(filter_fallback_format());
  54. }