Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pjsde committed Jun 4, 2022
1 parent 8872eb9 commit a7317d9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 14 additions & 1 deletion user_guide_src/source/incoming/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Placeholders Description
============ ===========================================================================================================

.. note:: ``{locale}`` cannot be used as a placeholder or other part of the route, as it is reserved for use
in :doc:`localization </outgoing/localization>`.
in :doc:`localization </outgoing/localization>` (see also :ref:`locale-placeholder`).

Examples
========
Expand Down Expand Up @@ -145,6 +145,19 @@ In such a case, you can specify the parameters manually:
.. literalinclude:: routing/016.php
:lines: 2-

.. _locale-placeholder:

Locale Placeholder
==================

The placeholder ``{locale}`` is a reserved placeholder that is used in :doc:`localization </outgoing/localization>`
and has the following Regular Expression pattern ``[^/]+``.

You can override the default pattern with the ``setLocalePattern()`` method. The parameter is the Regular Expression
pattern it should be replaced with:

.. literalinclude:: routing/053.php

Custom Placeholders
===================

Expand Down
3 changes: 3 additions & 0 deletions user_guide_src/source/incoming/routing/053.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

$routes->setLocalePattern('[a-z]{2}[_-][A-Z]{2}');

0 comments on commit a7317d9

Please sign in to comment.