9292Setting the Current Locale
9393==========================
9494
95- If you want to set the locale directly, you may use
96- ``IncomingRequest::setLocale(string $locale) ``.
95+ IncomingRequest Locale
96+ ----------------------
97+
98+ If you want to set the locale directly, you may use the ``setLocale() `` method in
99+ the :doc: `../incoming/incomingrequest `:
100+
101+ .. literalinclude :: localization/020.php
102+ :lines: 2-
97103
98104Before setting the locale, you must set valid locales. Because any attempt to
99105set a locale that are not valid will result in
@@ -108,6 +114,18 @@ in **app/Config/App.php**:
108114 set (and reset) valid locales. Use it if you want to change the valid locales
109115 dynamically.
110116
117+ Language Locale
118+ ---------------
119+
120+ The ``Language `` class used in the :php:func: `lang() ` function also has the current
121+ locale. This is set to the ``IncommingRequest `` locale during instantiating.
122+
123+ If you want to change the locale after instantiating the language class, use the
124+ ``Language::setLocale() `` method.
125+
126+ .. literalinclude :: localization/021.php
127+ :lines: 2-
128+
111129Retrieving the Current Locale
112130=============================
113131
@@ -218,10 +236,12 @@ Specifying Locale
218236-----------------
219237
220238To specify a different locale to be used when replacing parameters, you can pass the locale in as the
221- third parameter to the `` lang() ` ` function.
239+ third parameter to the :php:func: ` lang() ` function.
222240
223241.. literalinclude :: localization/016.php
224242
243+ If you want to change the current locale, see `Language Locale `_.
244+
225245Nested Arrays
226246-------------
227247
0 commit comments