Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

Application modulaire fonctionnelle !

Emmanuel ROY authored on 12/08/2019 15:10:25
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,63 +0,0 @@
1
-<?php
2
-
3
-/*
4
- * This file is part of the Symfony package.
5
- *
6
- * (c) Fabien Potencier <fabien@symfony.com>
7
- *
8
- * For the full copyright and license information, please view the LICENSE
9
- * file that was distributed with this source code.
10
- */
11
-
12
-namespace Symfony\Component\Translation\Reader;
13
-
14
-use Symfony\Component\Finder\Finder;
15
-use Symfony\Component\Translation\Loader\LoaderInterface;
16
-use Symfony\Component\Translation\MessageCatalogue;
17
-
18
-/**
19
- * TranslationReader reads translation messages from translation files.
20
- *
21
- * @author Michel Salib <michelsalib@hotmail.com>
22
- */
23
-class TranslationReader implements TranslationReaderInterface
24
-{
25
-    /**
26
-     * Loaders used for import.
27
-     *
28
-     * @var array
29
-     */
30
-    private $loaders = [];
31
-
32
-    /**
33
-     * Adds a loader to the translation extractor.
34
-     *
35
-     * @param string          $format The format of the loader
36
-     * @param LoaderInterface $loader
37
-     */
38
-    public function addLoader($format, LoaderInterface $loader)
39
-    {
40
-        $this->loaders[$format] = $loader;
41
-    }
42
-
43
-    /**
44
-     * {@inheritdoc}
45
-     */
46
-    public function read($directory, MessageCatalogue $catalogue)
47
-    {
48
-        if (!is_dir($directory)) {
49
-            return;
50
-        }
51
-
52
-        foreach ($this->loaders as $format => $loader) {
53
-            // load any existing translation files
54
-            $finder = new Finder();
55
-            $extension = $catalogue->getLocale().'.'.$format;
56
-            $files = $finder->files()->name('*.'.$extension)->in($directory);
57
-            foreach ($files as $file) {
58
-                $domain = substr($file->getFilename(), 0, -1 * \strlen($extension) - 1);
59
-                $catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
60
-            }
61
-        }
62
-    }
63
-}
Browse code

initial commit

Emmanuel ROY authored on 09/08/2019 08:39:02
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,63 @@
1
+<?php
2
+
3
+/*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+namespace Symfony\Component\Translation\Reader;
13
+
14
+use Symfony\Component\Finder\Finder;
15
+use Symfony\Component\Translation\Loader\LoaderInterface;
16
+use Symfony\Component\Translation\MessageCatalogue;
17
+
18
+/**
19
+ * TranslationReader reads translation messages from translation files.
20
+ *
21
+ * @author Michel Salib <michelsalib@hotmail.com>
22
+ */
23
+class TranslationReader implements TranslationReaderInterface
24
+{
25
+    /**
26
+     * Loaders used for import.
27
+     *
28
+     * @var array
29
+     */
30
+    private $loaders = [];
31
+
32
+    /**
33
+     * Adds a loader to the translation extractor.
34
+     *
35
+     * @param string          $format The format of the loader
36
+     * @param LoaderInterface $loader
37
+     */
38
+    public function addLoader($format, LoaderInterface $loader)
39
+    {
40
+        $this->loaders[$format] = $loader;
41
+    }
42
+
43
+    /**
44
+     * {@inheritdoc}
45
+     */
46
+    public function read($directory, MessageCatalogue $catalogue)
47
+    {
48
+        if (!is_dir($directory)) {
49
+            return;
50
+        }
51
+
52
+        foreach ($this->loaders as $format => $loader) {
53
+            // load any existing translation files
54
+            $finder = new Finder();
55
+            $extension = $catalogue->getLocale().'.'.$format;
56
+            $files = $finder->files()->name('*.'.$extension)->in($directory);
57
+            foreach ($files as $file) {
58
+                $domain = substr($file->getFilename(), 0, -1 * \strlen($extension) - 1);
59
+                $catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain));
60
+            }
61
+        }
62
+    }
63
+}