mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Locales: use http-accept-language or cookie (#976)
* Locales: use http-accept-language or "language"-cookie * Add user-setting "locale" Rename CULTURE to DEFAULT_LOCALE * Use LocaleMiddleware also in dev mode * CORS: don't require authentication on OPTIONS * Use a standard user-settings-control and start a new generic user settings page, not a separate page for the locale setting * Fixed (broken by myself) link-return handling * Clarify language settings * Removed unneeded files * Better user settings icon * Added localization hints Co-authored-by: Bernd Bestel <bernd@berrnd.de>
This commit is contained in:
committed by
GitHub
parent
4a030b7ffc
commit
6f8ad9b76e
@@ -35,7 +35,7 @@ class BaseService
|
||||
|
||||
protected function getLocalizationService()
|
||||
{
|
||||
return LocalizationService::getInstance(GROCY_CULTURE);
|
||||
return LocalizationService::getInstance(GROCY_LOCALE);
|
||||
}
|
||||
|
||||
protected function getStockservice()
|
||||
|
@@ -22,7 +22,7 @@ class DatabaseService
|
||||
{
|
||||
if (GROCY_MODE === 'demo' || GROCY_MODE === 'prerelease')
|
||||
{
|
||||
return GROCY_DATAPATH . '/grocy_' . GROCY_CULTURE . '.db';
|
||||
return GROCY_DATAPATH . '/grocy_' . GROCY_DEFAULT_LOCALE . '.db';
|
||||
}
|
||||
|
||||
return GROCY_DATAPATH . '/grocy.db';
|
||||
|
@@ -9,7 +9,7 @@ class DemoDataGeneratorService extends BaseService
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->LocalizationService = new LocalizationService(GROCY_CULTURE);
|
||||
$this->LocalizationService = new LocalizationService(GROCY_DEFAULT_LOCALE);
|
||||
}
|
||||
|
||||
protected $LocalizationService;
|
||||
|
@@ -61,6 +61,8 @@ class LocalizationService
|
||||
$this->Pot = $this->Pot->mergeWith(Translations::fromPoFile(__DIR__ . '/../localization/strings.pot'));
|
||||
$this->Pot = $this->Pot->mergeWith(Translations::fromPoFile(__DIR__ . '/../localization/userfield_types.pot'));
|
||||
$this->Pot = $this->Pot->mergeWith(Translations::fromPoFile(__DIR__ . '/../localization/permissions.pot'));
|
||||
$this->Pot = $this->Pot->mergeWith(Translations::fromPoFile(__DIR__ . '/../localization/locales.pot'));
|
||||
|
||||
|
||||
if (GROCY_MODE !== 'production')
|
||||
{
|
||||
@@ -96,6 +98,10 @@ class LocalizationService
|
||||
{
|
||||
$this->Po = $this->Po->mergeWith(Translations::fromPoFile(__DIR__ . "/../localization/$culture/permissions.po"));
|
||||
}
|
||||
if (file_exists(__DIR__ . "/../localization/$culture/locales.po"))
|
||||
{
|
||||
$this->Po = $this->Po->mergeWith(Translations::fromPoFile(__DIR__ . "/../localization/$culture/locales.po"));
|
||||
}
|
||||
if (GROCY_MODE !== 'production' && file_exists(__DIR__ . "/../localization/$culture/demo_data.po"))
|
||||
{
|
||||
$this->Po = $this->Po->mergeWith(Translations::fromPoFile(__DIR__ . "/../localization/$culture/demo_data.po"));
|
||||
|
Reference in New Issue
Block a user