GettextFile.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\i18n;
  8. use yii\base\Component;
  9. /**
  10. * GettextFile is the base class for representing a Gettext message file.
  11. *
  12. * @author Qiang Xue <qiang.xue@gmail.com>
  13. * @since 2.0
  14. */
  15. abstract class GettextFile extends Component
  16. {
  17. /**
  18. * Loads messages from a file.
  19. * @param string $filePath file path
  20. * @param string $context message context
  21. * @return array message translations. Array keys are source messages and array values are translated messages:
  22. * source message => translated message.
  23. */
  24. abstract public function load($filePath, $context);
  25. /**
  26. * Saves messages to a file.
  27. * @param string $filePath file path
  28. * @param array $messages message translations. Array keys are source messages and array values are
  29. * translated messages: source message => translated message. Note if the message has a context,
  30. * the message ID must be prefixed with the context with chr(4) as the separator.
  31. */
  32. abstract public function save($filePath, $messages);
  33. }