Translation.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * @package Exception
  4. *
  5. * Copyright 2010-2013 Horde LLC (http://www.horde.org/)
  6. *
  7. * See the enclosed file COPYING for license information (LGPL). If you
  8. * did not receive this file, see http://www.horde.org/licenses/lgpl21.
  9. */
  10. /**
  11. * Horde_Exception_Translation is the translation wrapper class for Horde_Exception.
  12. *
  13. * @author Jan Schneider <jan@horde.org>
  14. * @package Exception
  15. */
  16. class Horde_Exception_Translation extends Horde_Translation
  17. {
  18. /**
  19. * Returns the translation of a message.
  20. *
  21. * @var string $message The string to translate.
  22. *
  23. * @return string The string translation, or the original string if no
  24. * translation exists.
  25. */
  26. static public function t($message)
  27. {
  28. self::$_domain = 'Horde_Exception';
  29. self::$_directory = '@data_dir@' == '@'.'data_dir'.'@' ? __DIR__ . '/../../../locale' : '@data_dir@/Horde_Exception/locale';
  30. return parent::t($message);
  31. }
  32. /**
  33. * Returns the plural translation of a message.
  34. *
  35. * @param string $singular The singular version to translate.
  36. * @param string $plural The plural version to translate.
  37. * @param integer $number The number that determines singular vs. plural.
  38. *
  39. * @return string The string translation, or the original string if no
  40. * translation exists.
  41. */
  42. static public function ngettext($singular, $plural, $number)
  43. {
  44. self::$_domain = 'Horde_Exception';
  45. self::$_directory = '@data_dir@' == '@'.'data_dir'.'@' ? __DIR__ . '/../../../locale' : '@data_dir@/Horde_Exception/locale';
  46. return parent::ngettext($singular, $plural, $number);
  47. }
  48. }