diff --git a/user_guide_src/source/incoming/routing.rst b/user_guide_src/source/incoming/routing.rst index dc27a5aeb8e3..9a206e7b096d 100644 --- a/user_guide_src/source/incoming/routing.rst +++ b/user_guide_src/source/incoming/routing.rst @@ -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 `. + in :doc:`localization ` (see also :ref:`locale-placeholder`). Examples ======== @@ -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 ` +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 =================== diff --git a/user_guide_src/source/incoming/routing/053.php b/user_guide_src/source/incoming/routing/053.php new file mode 100644 index 000000000000..5348dad4ed4c --- /dev/null +++ b/user_guide_src/source/incoming/routing/053.php @@ -0,0 +1,3 @@ +setLocalePattern('[a-z]{2}[_-][A-Z]{2}');