Locale.php 950 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. *
  4. * Cube Framework $Id$ 8ovkBqaf1epmTeM7o56rGT9bUZA80PQ9hPf93TlApKA=
  5. *
  6. * @link http://codecu.be/framework
  7. * @copyright Copyright (c) 2014 CodeCube SRL
  8. * @license http://codecu.be/framework/license Commercial License
  9. *
  10. * @version 1.0
  11. */
  12. /**
  13. * locale resource management class
  14. */
  15. namespace Cube\Application\Resource;
  16. use Cube\Locale as LocaleObject;
  17. class Locale extends AbstractResource
  18. {
  19. /**
  20. *
  21. * @var \Cube\Locale;
  22. */
  23. protected $_locale;
  24. /**
  25. *
  26. * initialize locale object based on resource settings
  27. *
  28. * @return \Cube\Locale
  29. */
  30. public function init()
  31. {
  32. if (!($this->_locale instanceof LocaleObject)) {
  33. $code = (isset($this->_options['locale']['default'])) ? $this->_options['locale']['default'] : null;
  34. $this->_locale = new LocaleObject($code);
  35. }
  36. return $this->_locale;
  37. }
  38. }