File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
user_guide_src/source/incoming Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -121,24 +121,15 @@ that the strict comparison will be made in the first place.
121121 if you have your own translation files, you **must also change ** the folder names for CodeIgniter's translation files to match
122122 what you put in the ``$supportedLocales `` array.
123123
124- Now let's consider the below example. The browser's preferred language will be set as this::
124+ Now let's consider the below example. The browser's preferred language will be set as this::
125125
126126 GET /foo HTTP/1.1
127127 Accept-Language: fr; q=1.0, en-GB; q=0.5
128128
129- In this example, the browser would prefer French, with a second choice of English (United Kingdom). Your website on another hand will
129+ In this example, the browser would prefer French, with a second choice of English (United Kingdom). Your website on another hand
130130supports German and English (United States):
131131
132- .. code-block :: php
133-
134- $supported = [
135- 'de',
136- 'en-US',
137- ];
138-
139- $lang = $request->negotiate('language', $supported);
140- // or
141- $lang = $negotiate->language($supported);
132+ .. literalinclude :: content_negotiation/008.php
142133
143134In this example, 'en-US' would be returned as the current language. If no match is found, it will return the first element
144135in the ``$supported `` array. Here is how exactly the locale selection process works.
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ $ supported = [
4+ 'de ' ,
5+ 'en-US ' ,
6+ ];
7+
8+ $ lang = $ request ->negotiate ('language ' , $ supported );
9+ // or
10+ $ lang = $ negotiate ->language ($ supported );
You can’t perform that action at this time.
0 commit comments