Skip to content

Commit

Permalink
Fixed User set locale, but not working translation
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Jun 15, 2021
1 parent 33877c9 commit d63c09c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Jobs/Install/DisableModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($alias, $company_id, $locale = null)
{
$this->alias = $alias;
$this->company_id = $company_id;
$this->locale = $locale ?: app()->getLocale();
$this->locale = $locale ?: company($company_id)->locale;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Install/EnableModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($alias, $company_id, $locale = null)
{
$this->alias = $alias;
$this->company_id = $company_id;
$this->locale = $locale ?: app()->getLocale();
$this->locale = $locale ?: company($company_id)->locale;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Install/InstallModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($alias, $company_id, $locale = null)
{
$this->alias = $alias;
$this->company_id = $company_id;
$this->locale = $locale ?: app()->getLocale();
$this->locale = $locale ?: company($company_id)->locale;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/Install/UninstallModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($alias, $company_id, $locale = null)
{
$this->alias = $alias;
$this->company_id = $company_id;
$this->locale = $locale ?: app()->getLocale();
$this->locale = $locale ?: company($company_id)->locale;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/Utilities/Overrider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ protected static function loadSettings()

// Locale
if (session('locale') == '') {
app()->setLocale(setting('default.locale'));
$locale = (user()->locale) ?? setting('default.locale');

app()->setLocale($locale);
}

// Set app url dynamically if empty
Expand Down
4 changes: 2 additions & 2 deletions database/seeds/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ private function create()
Artisan::call('module:install', [
'alias' => 'offline-payments',
'company' => $company_id,
'locale' => session('locale', app()->getLocale()),
'locale' => session('locale', company($company_id)->locale),
]);

Artisan::call('module:install', [
'alias' => 'paypal-standard',
'company' => $company_id,
'locale' => session('locale', app()->getLocale()),
'locale' => session('locale', company($company_id)->locale),
]);
}
}
2 changes: 1 addition & 1 deletion database/seeds/TestCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function installModules()
Artisan::call('module:install', [
'alias' => $alias,
'company' => company_id(),
'locale' => session('locale', app()->getLocale()),
'locale' => session('locale', company(company_id())->locale),
]);
}

Expand Down

0 comments on commit d63c09c

Please sign in to comment.