Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'remotes/zf2/master' into test/feed-entr…
Browse files Browse the repository at this point in the history
…y-type-detection
  • Loading branch information
Fritz Gerneth committed Jul 5, 2012
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

49 changes: 49 additions & 0 deletions src/Translator/TranslatorServiceFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_I18n
* @subpackage Translator
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\I18n\Translator;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

/**
* Translator.
*
* @category Zend
* @package Zend_I18n
* @subpackage Translator
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class TranslatorServiceFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator)
{
// Configure the translator
$config = $serviceLocator->get('Configuration');
$translator = Translator::factory($config['translator']);

// Provide translator to the view helper
$serviceLocator->get('ViewHelperManager')->get('translator')->setTranslator($translator);

return $translator;
}
}

0 comments on commit 33c7531

Please sign in to comment.