From a7317d914a8f31d8424c8e9e08e905ba8811bea2 Mon Sep 17 00:00:00 2001 From: Paulo Esteves Date: Sat, 4 Jun 2022 18:46:06 +0100 Subject: [PATCH] Add docs --- user_guide_src/source/incoming/routing.rst | 15 ++++++++++++++- user_guide_src/source/incoming/routing/053.php | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 user_guide_src/source/incoming/routing/053.php 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}');