You are here

public function i18n_string_object_wrapper::get_strings in Internationalization 7

Get object strings for translation

This will return a simple array of string objects, indexed by full string name.

Parameters

$options: Array with processing options.

  • 'empty', whether to return empty strings, defaults to FALSE.
2 calls to i18n_string_object_wrapper::get_strings()
i18n_string_object_wrapper::strings_update in i18n_string/i18n_string.inc
Update all strings for this object.
i18n_string_object_wrapper::translate_object in i18n_string/i18n_string.inc
Translate all properties for object.

File

i18n_string/i18n_string.inc, line 1125
API for internationalization strings

Class

i18n_string_object_wrapper
String object wrapper

Code

public function get_strings($options = array()) {
  $options += array(
    'empty' => FALSE,
  );
  $strings = array();
  foreach ($this
    ->get_properties() as $textgroup => $textgroup_list) {
    foreach ($textgroup_list as $type => $type_list) {
      foreach ($type_list as $object_id => $object_list) {
        foreach ($object_list as $key => $string) {
          if ($options['empty'] || !empty($string['string'])) {

            // Build string object, that will trigger static caches everywhere.
            $i18nstring = i18n_string_textgroup($textgroup)
              ->build_string(array(
              $type,
              $object_id,
              $key,
            ))
              ->set_string($string);
            $strings[$i18nstring
              ->get_name()] = $i18nstring;
          }
        }
      }
    }
  }
  return $strings;
}