Skip to content

Commit

Permalink
Remocing code that at the end was not actually useful as it was growing
Browse files Browse the repository at this point in the history
in complexity.
  • Loading branch information
lorenzo committed Jul 27, 2014
1 parent 6fa2765 commit 1720b81
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 138 deletions.
27 changes: 1 addition & 26 deletions src/I18n/TranslatorRegistry.php
Expand Up @@ -14,38 +14,14 @@
*/
namespace Cake\I18n;

use Aura\Intl\FormatterLocator;
use Aura\Intl\TranslatorLocator;
use Aura\Intl\PackageLocatorInterface;
use Cake\Cache\Cache;
use Serializable;

/**
*
*/
class TranslatorRegistry extends TranslatorLocator implements Serializable {

public function serialize() {
return serialize($this->registry);
}

public function unserialize($data) {
$this->registry = unserialize($data);
}

/**
* Appends every loaded translator from the passed $registry into this registry,
* Any translator that has not yet been fetch from its internal packages will
* not be put into this registry.
*
* @param \Aura\Int\TranslatorLocator $registry The locator from wich to merge
* the loaded translators.
* @return void
*/
public function merge(TranslatorLocator $registry) {
$registry = $this->registry ?: [];
$this->registry = array_merge_recursive($registry->registry, $registry);
}
class TranslatorRegistry extends TranslatorLocator {

/**
* Appends every loaded translator from the passed $registry into this registry,
Expand All @@ -71,5 +47,4 @@ public function get($name, $locale = null) {
return $this->registry[$name][$locale];
}


}
14 changes: 0 additions & 14 deletions tests/TestCase/I18n/I18nTest.php
Expand Up @@ -267,18 +267,4 @@ public function testBasicContextFunction() {
);
}

public function testTranslatorsSerialize() {
$default = I18n::translator();
$this->assertEquals('%d is 1 (po translated)', $default->translate('%d = 1'));

$translators = I18n::translators();
$serialized = serialize($translators);
$restored = unserialize($serialized);

$this->assertEquals(
$restored->get('default', 'en_US')->translate('%d = 1'),
$default->translate('%d = 1')
);
}

}
98 changes: 0 additions & 98 deletions tests/TestCase/I18n/TranslatorRegistryTest.php

This file was deleted.

0 comments on commit 1720b81

Please sign in to comment.