File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,35 @@ with a locale. This can be done by defining a different prefix for each locale
230
230
en : ' ' # don't prefix URLs for English, the default locale
231
231
nl : ' /nl'
232
232
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
+
233
262
.. _routing-requirements :
234
263
235
264
Adding {wildcard} Requirements
You can’t perform that action at this time.
0 commit comments