diff --git a/UPGRADE-3.4.md b/UPGRADE-3.4.md
index 503e74922ce41..c359f0695a4ab 100644
--- a/UPGRADE-3.4.md
+++ b/UPGRADE-3.4.md
@@ -42,6 +42,9 @@ FrameworkBundle
* The `--no-prefix` option of the `translation:update` command is deprecated and
will be removed in 4.0. Use the `--prefix` option with an empty string as value
instead (e.g. `--prefix=""`)
+
+ * The class `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader` was
+ moved to the Translation component (`Symfony\Component\Translation\Loader\TranslationLoader`)
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass`
class has been deprecated and will be removed in 4.0. Use the
diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md
index 5a8042835c2da..0c1d383a6dda7 100644
--- a/UPGRADE-4.0.md
+++ b/UPGRADE-4.0.md
@@ -348,6 +348,9 @@ FrameworkBundle
* The `--no-prefix` option of the `translation:update` command has
been removed.
+
+ * The class `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader` was
+ moved to the Translation component (`Symfony\Component\Translation\Loader\TranslationLoader`)
* The `Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass` class has been removed.
Use the `Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass` class instead.
diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
index a06afaae0a726..c022bbbee19c1 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -22,6 +22,8 @@ CHANGELOG
name as value, using it makes the command lazy
* Added `cache:pool:prune` command to allow manual stale cache item pruning of supported PSR-6 and PSR-16 cache pool
implementations
+ * Deprecated `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`, use
+ `Symfony\Component\Translation\Loader\TranslationLoader` instead
3.3.0
-----
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
index 79b4234d81eb8..49cb9c39933ab 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
@@ -11,7 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\Command;
-use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;
+use Symfony\Component\Translation\Loader\TranslationLoader;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
index cd0a983010c8a..993cafbb1df51 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml
@@ -121,7 +121,7 @@
-
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index 19c6d70156b19..3694cfc6e1131 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -141,7 +141,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
})
);
- $loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
+ $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\TranslationLoader')->getMock();
$loader
->expects($this->any())
->method('loadMessages')
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
index e845619d9a826..286ada506f869 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationUpdateCommandTest.php
@@ -113,7 +113,7 @@ private function getContainer($extractedMessages = array(), $loadedMessages = ar
})
);
- $loader = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader')->getMock();
+ $loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\TranslationLoader')->getMock();
$loader
->expects($this->any())
->method('loadMessages')
diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php b/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php
index b6377863afe48..8a38e10483e16 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Translation/TranslationLoader.php
@@ -11,56 +11,11 @@
namespace Symfony\Bundle\FrameworkBundle\Translation;
-use Symfony\Component\Finder\Finder;
-use Symfony\Component\Translation\MessageCatalogue;
-use Symfony\Component\Translation\Loader\LoaderInterface;
+@trigger_error(sprintf('The class "%s" has been deprecated. Use "%s" instead. ', self::class, \Symfony\Component\Translation\Loader\TranslationLoader::class), E_USER_DEPRECATED);
/**
- * TranslationLoader loads translation messages from translation files.
- *
- * @author Michel Salib
+ * @deprecated Class moved to Symfony\Component\Translation\Loader\TranslationLoader
*/
-class TranslationLoader
+class TranslationLoader extends \Symfony\Component\Translation\Loader\TranslationLoader
{
- /**
- * Loaders used for import.
- *
- * @var array
- */
- private $loaders = array();
-
- /**
- * Adds a loader to the translation extractor.
- *
- * @param string $format The format of the loader
- * @param LoaderInterface $loader
- */
- public function addLoader($format, LoaderInterface $loader)
- {
- $this->loaders[$format] = $loader;
- }
-
- /**
- * Loads translation messages from a directory to the catalogue.
- *
- * @param string $directory the directory to look into
- * @param MessageCatalogue $catalogue the catalogue
- */
- public function loadMessages($directory, MessageCatalogue $catalogue)
- {
- if (!is_dir($directory)) {
- return;
- }
-
- foreach ($this->loaders as $format => $loader) {
- // load any existing translation files
- $finder = new Finder();
- $extension = $catalogue->getLocale().'.'.$format;
- $files = $finder->files()->name('*.'.$extension)->in($directory);
- foreach ($files as $file) {
- $domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1);
- $catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
- }
- }
- }
}
diff --git a/src/Symfony/Component/Translation/CHANGELOG.md b/src/Symfony/Component/Translation/CHANGELOG.md
index baa791b0ad174..718108efdfd8f 100644
--- a/src/Symfony/Component/Translation/CHANGELOG.md
+++ b/src/Symfony/Component/Translation/CHANGELOG.md
@@ -7,6 +7,7 @@ CHANGELOG
* Added `TranslationDumperPass`
* Added `TranslationExtractorPass`
* Added `TranslatorPass`
+ * Added class `Symfony\Component\Translation\Loader\TranslationLoader` from FrameworkBundle
3.2.0
-----
diff --git a/src/Symfony/Component/Translation/Loader/TranslationLoader.php b/src/Symfony/Component/Translation/Loader/TranslationLoader.php
new file mode 100644
index 0000000000000..0cfcd87bdd43f
--- /dev/null
+++ b/src/Symfony/Component/Translation/Loader/TranslationLoader.php
@@ -0,0 +1,65 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Translation\Loader;
+
+use Symfony\Component\Finder\Finder;
+use Symfony\Component\Translation\MessageCatalogue;
+
+/**
+ * TranslationLoader loads translation messages from translation files.
+ *
+ * @author Michel Salib
+ */
+class TranslationLoader
+{
+ /**
+ * Loaders used for import.
+ *
+ * @var array
+ */
+ private $loaders = array();
+
+ /**
+ * Adds a loader to the translation extractor.
+ *
+ * @param string $format The format of the loader
+ * @param LoaderInterface $loader
+ */
+ public function addLoader($format, LoaderInterface $loader)
+ {
+ $this->loaders[$format] = $loader;
+ }
+
+ /**
+ * Loads translation messages from a directory to the catalogue.
+ *
+ * @param string $directory the directory to look into
+ * @param MessageCatalogue $catalogue the catalogue
+ */
+ public function loadMessages($directory, MessageCatalogue $catalogue)
+ {
+ if (!is_dir($directory)) {
+ return;
+ }
+
+ foreach ($this->loaders as $format => $loader) {
+ // load any existing translation files
+ $finder = new Finder();
+ $extension = $catalogue->getLocale().'.'.$format;
+ $files = $finder->files()->name('*.'.$extension)->in($directory);
+ foreach ($files as $file) {
+ $domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1);
+ $catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
+ }
+ }
+ }
+}
diff --git a/src/Symfony/Component/Translation/composer.json b/src/Symfony/Component/Translation/composer.json
index 3f59d4214f6c5..9371bc0c65f4c 100644
--- a/src/Symfony/Component/Translation/composer.json
+++ b/src/Symfony/Component/Translation/composer.json
@@ -24,6 +24,7 @@
"symfony/dependency-injection": "~3.4|~4.0",
"symfony/intl": "^2.8.18|^3.2.5|~4.0",
"symfony/yaml": "~3.3|~4.0",
+ "symfony/finder": "~2.8|~3.0|~4.0",
"psr/log": "~1.0"
},
"conflict": {