Skip to content

Commit ae1060a

Browse files
authored
Update docs in README according to Symfony 4 (#297)
Upgrade docs according to Symfony 4 structure and sync code examples with the recipe.
1 parent c6aa0cf commit ae1060a

File tree

1 file changed

+36
-26
lines changed

1 file changed

+36
-26
lines changed

Readme.md

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,56 @@
1313

1414
## Install
1515

16-
Via Composer
16+
Install this bundle via Composer:
1717

1818
``` bash
1919
$ composer require php-translation/symfony-bundle
2020
```
2121

22+
If you're using [Symfony Flex][symfony_flex] - you're done! Symfony Flex will create default
23+
configuration for you, change it if needed. If you don't use Symfony Flex, you will need to do
24+
a few more simple steps.
25+
26+
1. First, register the bundle:
27+
2228
```php
23-
class AppKernel extends Kernel
24-
{
25-
public function registerBundles()
26-
{
27-
$bundles = array(
28-
// ...
29-
new Translation\Bundle\TranslationBundle(),
30-
}
31-
}
32-
}
29+
# config/bundles.php
30+
return [
31+
// ...
32+
Translation\Bundle\TranslationBundle::class => ['all' => true],
33+
];
3334
```
3435

35-
An example configuration looks like this:
36+
2. Then, configure the bundle. An example configuration looks like this:
3637

3738
```yaml
38-
# config.yml
39+
# config/packages/php_translation.yaml
3940
translation:
40-
locales: ["en", "sv"]
41-
symfony_profiler: # must be placed in config_dev.yml
42-
enabled: true
43-
webui:
44-
enabled: true
41+
locales: ["en"]
4542
edit_in_place:
46-
enabled: true
47-
config_name: default # the first one or one of your configs
48-
activator: php_translation.edit_in_place.activator
43+
enabled: false
44+
config_name: app
4945
configs:
5046
app:
51-
dirs: ["%kernel.root_dir%/Resources/views", "%kernel.root_dir%/../src"]
52-
output_dir: "%kernel.root_dir%/Resources/translations"
47+
dirs: ["%kernel.project_dir%/templates", "%kernel.project_dir%/src"]
48+
output_dir: "%kernel.project_dir%/translations"
5349
excluded_names: ["*TestCase.php", "*Test.php"]
5450
excluded_dirs: [cache, data, logs]
5551
```
5652
5753
```yaml
58-
# routing_dev.yml
54+
# config/packages/dev/php_translation.yaml
55+
translation:
56+
symfony_profiler:
57+
enabled: true
58+
webui:
59+
enabled: true
60+
```
61+
62+
3. And the last step, add new routes:
63+
64+
```yaml
65+
# config/routes/dev/php_translation.yaml
5966
_translation_webui:
6067
resource: "@TranslationBundle/Resources/config/routing_webui.yml"
6168
prefix: /admin
@@ -65,12 +72,15 @@ _translation_profiler:
6572
```
6673
6774
```yaml
68-
# routing.yml
75+
# config/routes/php_translation.yaml
6976
_translation_edit_in_place:
7077
resource: '@TranslationBundle/Resources/config/routing_edit_in_place.yml'
7178
prefix: /admin
7279
```
7380
7481
## Documentation
7582
76-
Read the full documentation at [http://php-translation.readthedocs.io](http://php-translation.readthedocs.io/en/latest/).
83+
Read the full documentation at [http://php-translation.readthedocs.io](https://php-translation.readthedocs.io/en/latest/).
84+
85+
86+
[symfony_flex]: https://github.com/symfony/flex

0 commit comments

Comments
 (0)