8000 minor #10471 Added the missing XML and PHP formats to some config (ja… · symfony/symfony-docs@f1865b0 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1865b0

Browse files
committed
minor #10471 Added the missing XML and PHP formats to some config (javiereguiluz)
This PR was squashed before being merged into the 4.1 branch (closes #10471). Discussion ---------- Added the missing XML and PHP formats to some config I'm sure I did it wrong ... so let's ping our expert @xabbuh to please review these changes. Thanks! Commits ------- de326a6 Added the missing XML and PHP formats to some config
2 parents 49cb23d + de326a6 commit f1865b0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

routing.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,35 @@ with a locale. This can be done by defining a different prefix for each locale
231231
en: '' # don't prefix URLs for English, the default locale
232232
nl: '/nl'
233233
234+
.. code-block:: xml
235+
236+
<!-- config/routes/annotations.xml -->
237+
<?xml version="1.0" encoding="UTF-8" ?>
238+
<routes xmlns="http://symfony.com/schema/routing"
239+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
240+
xsi:schemaLocation="http://symfony.com/schema/routing
241+
http://symfony.com/schema/routing/routing-1.0.xsd">
242+
243+
<import resource="../src/Controller/" type="annotation">
244+
<!-- don't prefix URLs for English, the default locale -->
245+
<prefix locale="en"></prefix>
246+
<prefix locale="nl">/nl</prefix>
247+
</import>
248+
</routes>
249+
250+
.. code-block:: php
251+
252+
// config/routes/annotations.php
253+
use Symfony\Component\Routing\RouteCollection;
254+
255+
$routes = $loader->import('../src/Controller/', 'annotation');
256+
257+
// don't prefix URLs for English, the default locale
258+
$app->addPrefix('/', array('_locale' => 'en'));
259+
$app->addPrefix('/nl', array('_locale' => 'nl'));
260+
261+
return $routes;
262+
234263
.. _routing-requirements:
235264

236265
Adding {wildcard} Requirements

0 commit comments

Comments
 (0)
0