Skip to content

Commit 993bd22

Browse files
authored
Merge pull request #49 from odolbeau/extraction
Add some documentation about extraction
2 parents 51f43b1 + 507f067 commit 993bd22

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

symfony/extracting-translations.rst

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
11
Extracting Translations from Source
22
===================================
33

4-
TODO example how to extract source. Show different configurations and commands.
4+
Extracting translations from your project
5+
-----------------------------------------
6+
7+
.. code-block:: yaml
8+
9+
translation:
10+
locales: ["en", "fr", "sv"]
11+
configs:
12+
app:
13+
dirs: ["%kernel.root_dir%/Resources/views", "%kernel.root_dir%/../src"]
14+
output_dir: "%kernel.root_dir%/Resources/translations"
15+
excluded_names: ["*TestCase.php", "*Test.php"]
16+
excluded_dirs: [cache, data, logs]
17+
18+
With the configuration above you may extract all translation keys from your
19+
source code by running
20+
21+
.. code-block:: bash
22+
23+
php bin/console translation:extract app
24+
25+
Extracting translations from a bundle
26+
-------------------------------------
27+
28+
If you're using a bundle shipped with custom translations, you can extract
29+
them using ``external_translations_dir``.
30+
31+
For example, with `FOSUserBundle<https://github.com/FriendsOfSymfony/FOSUserBundle/>`:
32+
33+
.. code-block:: yaml
34+
35+
translation:
36+
configs:
37+
app:
38+
external_translations_dir: ["%kernel.root_dir%/vendor/friendsofsymfony/user-bundle/Resources/translations"]

symfony/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Below is an example of configuration that is great to start with.
6262
excluded_names: ["*TestCase.php", "*Test.php"]
6363
excluded_dirs: [cache, data, logs]
6464
65-
With the configuration above you may extract all translation key from your source
66-
code by running
65+
With the configuration above you may extract all translation keys from your
66+
source code by running
6767

6868
.. code-block:: bash
6969

0 commit comments

Comments
 (0)