This repository has been archived by the owner on Feb 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: detect language from browser (#929)
- Loading branch information
Showing
5 changed files
with
112 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
* Indicates whenever should autodetect and apply the language of the request. | ||
*/ | ||
'autodetect' => env('LANG_DETECTOR_AUTODETECT', false), | ||
|
||
/* | ||
* Default driver to use to detect the request language. | ||
* | ||
* Available: browser, subdomain, uri. | ||
*/ | ||
'driver' => env('LANG_DETECTOR_DRIVER', 'browser'), | ||
|
||
/* | ||
* Used on subdomain and uri drivers. That indicates which segment should be used | ||
* to verify the language. | ||
*/ | ||
'segment' => env('LANG_DETECTOR_SEGMENT', 0), | ||
|
||
/* | ||
* Languages available on the application. | ||
* | ||
* You could use parse_langs_to_array to use the string syntax | ||
* or just use the array of languages with its aliases. | ||
*/ | ||
'languages' => parse_langs_to_array( | ||
env('LANG_DETECTOR_LANGUAGES', ['en', 'fr']) | ||
), | ||
|
||
/* | ||
* Indicates if should store detected locale on cookies | ||
*/ | ||
'cookie' => (bool) env('LANG_DETECTOR_COOKIE', true), | ||
|
||
/* | ||
* Indicates if should encrypt cookie | ||
*/ | ||
'cookie_encrypt' => (bool) env('LANG_DETECTOR_COOKIE_ENCRYPT', false), | ||
|
||
/* | ||
* Cookie name | ||
*/ | ||
'cookie_name' => env('LANG_DETECTOR_COOKIE', 'locale'), | ||
]; |