i18nviews.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. class i18nviews extends i18n_string_object_wrapper {
  3. /**
  4. * Get string context
  5. */
  6. public function get_string_context() {
  7. return array('views', $this->object->name);
  8. }
  9. /**
  10. * Get translatable properties
  11. */
  12. protected function build_properties() {
  13. $strings = parent::build_properties();
  14. $properties = array();
  15. $this->object->init_display();
  16. foreach ($this->object->display as $display_id => $display) {
  17. $translatables = array();
  18. if(is_object($display->handler)) {
  19. $display->handler->unpack_translatables($translatables);
  20. }
  21. foreach ($translatables as $translatable) {
  22. $key = implode(':', $translatable['keys']);
  23. $properties[$display_id][$key] = array(
  24. 'title' => $display_id . ' ' . $key,
  25. 'string' => $translatable['value'],
  26. );
  27. }
  28. }
  29. $strings[$this->get_textgroup()][$this->object->name] = $properties;
  30. return $strings;
  31. }
  32. /**
  33. * Get edit path for oject.
  34. */
  35. public function get_edit_path() {
  36. return 'admin/structure/views/view/' . $this->object->name .'/edit';
  37. }
  38. /**
  39. * Get translate path for object
  40. */
  41. public function get_translate_path($langcode = NULL) {
  42. return 'admin/structure/views/view/' . $this->object->name .'/translate' . ($langcode ? '/' . $langcode : '');
  43. }
  44. }