mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Migrate translations to use Transifex
This commit is contained in:
@@ -10,8 +10,8 @@ class LocalizationService
|
||||
{
|
||||
$this->Culture = $culture;
|
||||
|
||||
$this->StringsDefaultCulture = $this->LoadLocalizationFile(self::DEFAULT_CULTURE);
|
||||
$this->StringsCurrentCulture = $this->LoadLocalizationFile($culture);
|
||||
$this->StringsDefaultCulture = $this->LoadLocalizations(self::DEFAULT_CULTURE);
|
||||
$this->StringsCurrentCulture = $this->LoadLocalizations($culture);
|
||||
$this->StringsMerged = array_merge($this->StringsDefaultCulture, $this->StringsCurrentCulture);
|
||||
}
|
||||
|
||||
@@ -20,18 +20,30 @@ class LocalizationService
|
||||
protected $StringsCurrentCulture;
|
||||
protected $StringsMerged;
|
||||
|
||||
private function LoadLocalizationFile(string $culture)
|
||||
private function LoadLocalizations(string $culture)
|
||||
{
|
||||
$file = __DIR__ . "/../localization/$culture.php";
|
||||
$folder = __DIR__ . "/../localization/$culture/";
|
||||
|
||||
if (file_exists($file))
|
||||
$localizationFiles = array(
|
||||
'strings.php',
|
||||
'stock_transaction_types.php',
|
||||
'chore_types.php',
|
||||
'component_translations.php',
|
||||
'demo_data.php'
|
||||
);
|
||||
|
||||
$stringsCombined = array();
|
||||
foreach ($localizationFiles as $localizationFile)
|
||||
{
|
||||
return require $file;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array();
|
||||
$file = $folder . $localizationFile;
|
||||
if (file_exists($file))
|
||||
{
|
||||
$currentStrings = require $file;
|
||||
$stringsCombined = array_merge($stringsCombined, $currentStrings);
|
||||
}
|
||||
}
|
||||
|
||||
return $stringsCombined;
|
||||
}
|
||||
|
||||
public function LogMissingLocalization(string $culture, string $text)
|
||||
|
Reference in New Issue
Block a user