You are here

function i18n_string_module_string_list in Internationalization 7

Get all strings from a module.

1 call to i18n_string_module_string_list()
i18n_string_refresh_enabled_modules in i18n_string/i18n_string.admin.inc
Refresh strings for enabled modules

File

i18n_string/i18n_string.admin.inc, line 280
Helper functions for string administration.

Code

function i18n_string_module_string_list($module) {
  $strings = array();

  // Try loading i18n.inc for the module and some library functions.
  module_load_include('i18n.inc', $module);
  module_load_include('i18n.inc', 'i18n_string');

  // If the module defines any textgroup, get all strings for this group
  if ($groups = module_invoke($module, 'i18n_string_info')) {
    foreach (array_keys($groups) as $group) {
      $strings = i18n_string_array_merge($strings, i18n_string_group_string_list($group));
    }
  }
  else {
    $groups = array();
  }

  // The module may implement i18n_string_list()
  if ($string_list = module_invoke($module, 'i18n_string_list', 'all')) {
    foreach ($string_list as $group => $group_strings) {
      if (!in_array($group, $groups)) {
        $strings[$group] = $group_strings;
      }
    }
  }

  // If the module defines any object that has strings in another textgroup
  if ($object_types = module_invoke($module, 'i18n_object_info')) {
    foreach ($object_types as $type => $type_info) {
      if (($group = i18n_string_object_info($type, 'textgroup')) && !in_array($group, $groups)) {
        if ($group_strings = i18n_string_object_type_string_list($type)) {
          $strings = i18n_string_array_merge($strings, $group_strings);
        }
      }
    }
  }
  return $strings;
}