tmgmt_file.format.interface.inc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Interface for exporting to a given file format.
  4. */
  5. interface TMGMTFileFormatInterface {
  6. /**
  7. * Return the file content for the job data.
  8. *
  9. * @param $job
  10. * The translation job object to be exported.
  11. * @param array $conditions
  12. * (optional) An array containing list of conditions.
  13. *
  14. * @return
  15. * String with the file content.
  16. */
  17. function export(TMGMTJob $job, $conditions = array());
  18. /**
  19. * Validates that the given file is valid and can be imported.
  20. *
  21. * @todo this function should NOT return a job. We need a import processor
  22. * instance instead to deal with the import context.
  23. *
  24. * @param string $imported_file
  25. * File path to the file to be imported.
  26. *
  27. * @return TMGMTJob
  28. * Returns the corresponding translation job entity if the import file is
  29. * valid, FALSE otherwise.
  30. */
  31. public function validateImport($imported_file);
  32. /**
  33. * Converts an exported file content back to the translated data.
  34. *
  35. * @param string $imported_file
  36. * Path to a file or an XML string to import.
  37. * @param bool $is_file
  38. * (optional) Whether $imported_file is the path to a file or not.
  39. *
  40. * @return
  41. * Translated data array.
  42. */
  43. function import($imported_file, $is_file = TRUE);
  44. }