Skip to content

Commit de326a6

Browse files
committed
Added the missing XML and PHP formats to some config
1 parent 7124775 commit de326a6

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

235264
Adding {wildcard} Requirements

0 commit comments

Comments
 (0)