@@ -77,6 +77,7 @@ placeholder ``{locale}`` can be placed as a segment in your route. If present, t
77
77
segment will be your locale:
78
78
79
79
.. literalinclude :: localization/004.php
80
+ :lines: 2-
80
81
81
82
In this example, if the user tried to visit **http://example.com/fr/books **, then the locale would be
82
83
set to ``fr ``, assuming it was configured as a valid locale.
@@ -86,6 +87,7 @@ locale will be used in it's place, unless you set to use only the supported loca
86
87
file:
87
88
88
89
.. literalinclude :: localization/018.php
90
+ :lines: 2-
89
91
90
92
.. note :: The ``useSupportedLocalesOnly()`` method can be used since v4.3.0.
91
93
@@ -137,6 +139,7 @@ If your controller is extending ``CodeIgniter\Controller``, this will be availab
137
139
Alternatively, you can use the :doc: `Services class </concepts/services >` to retrieve the current request:
138
140
139
141
.. literalinclude :: localization/006.php
142
+ :lines: 2-
140
143
141
144
.. _language-localization :
142
145
@@ -185,10 +188,12 @@ For example, to load the ``errorEmailMissing`` string from the **Errors.php**
185
188
language file, you would do the following:
186
189
187
190
.. literalinclude :: localization/010.php
191
+ :lines: 2-
188
192
189
193
For nested definition, you would do the following:
190
194
191
195
.. literalinclude :: localization/011.php
196
+ :lines: 2-
192
197
193
198
If the requested language key doesn't exist in the file for the current locale (after `Language Fallback `_), the string will be passed
194
199
back, unchanged. In this example, it would return ``Errors.errorEmailMissing `` or ``Errors.nested.error.message `` if it didn't exist.
@@ -208,10 +213,12 @@ You can pass an array of values to replace placeholders in the language string a
208
213
The first item in the placeholder corresponds to the index of the item in the array, if it's numerical:
209
214
210
215
.. literalinclude :: localization/013.php
216
+ :lines: 2-
211
217
212
218
You can also use named keys to make it easier to keep things straight, if you'd like:
213
219
214
220
.. literalinclude :: localization/014.php
221
+ :lines: 2-
215
222
216
223
Obviously, you can do more than just number replacement. According to the
217
224
`official ICU docs <https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/classMessageFormat.html#details >`_ for the underlying
0 commit comments