Use the APP_LOCALE variable in place of DEFAULT_LANGUAGE

This commit is contained in:
Kevin MacMartin 2024-05-10 16:19:59 -04:00
parent 2d8fc06dae
commit d9ccb3eaa8
4 changed files with 4 additions and 6 deletions

View file

@ -1,5 +1,3 @@
DEFAULT_LANGUAGE=en
APP_NAME='Hypothetical' APP_NAME='Hypothetical'
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=

View file

@ -18,7 +18,7 @@ class Language
*/ */
public static function getSessionLanguage() public static function getSessionLanguage()
{ {
return session(self::$language_cookie, env('DEFAULT_LANGUAGE', 'en')); return session(self::$language_cookie, env('APP_LOCALE', 'en'));
} }
/** /**
@ -43,7 +43,7 @@ class Language
public static function select($string_array) public static function select($string_array)
{ {
$session_language = self::getSessionLanguage(); $session_language = self::getSessionLanguage();
$default_language = env('DEFAULT_LANGUAGE'); $default_language = env('APP_LOCALE');
$string = ''; $string = '';
if (array_key_exists($session_language, $string_array)) { if (array_key_exists($session_language, $string_array)) {

View file

@ -121,7 +121,7 @@ Other information about database interaction, routing, controllers, etc can be v
### Language ### Language
The default language is set by the `DEFAULT_LANGUAGE` variable in the `.env` file; this will be the language used until the cookie has been updated. The default language is set by the `APP_LOCALE` variable in the `.env` file; this will be the language used until the cookie has been updated.
The language cookie can be updated a number of ways: The language cookie can be updated a number of ways:

View file

@ -8,7 +8,7 @@
var env = { var env = {
appName: "{!! env('APP_NAME') !!}", appName: "{!! env('APP_NAME') !!}",
appLang: "{{ Language::getSessionLanguage() }}", appLang: "{{ Language::getSessionLanguage() }}",
appDefaultLang: "{{ env('DEFAULT_LANGUAGE') }}", appDefaultLang: "{{ env('APP_LOCALE') }}",
apiToken: "{{ Auth::check() ? '?api_token=' . Auth::user()->api_token : '' }}", apiToken: "{{ Auth::check() ? '?api_token=' . Auth::user()->api_token : '' }}",
currentUrl: "{{ Request::url() }}", currentUrl: "{{ Request::url() }}",
csrfToken: "{{ csrf_token() }}", csrfToken: "{{ csrf_token() }}",