mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Sieve filters (alpha / beta version coming soon)
This commit is contained in:
parent
02ba68868f
commit
94789632f0
33 changed files with 544 additions and 81 deletions
75
build/langs.php
Normal file
75
build/langs.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
define('LANGS_PATH', __DIR__.'/../rainloop/v/0.0.0/langs');
|
||||
|
||||
function getLangStructure($sLangFile)
|
||||
{
|
||||
$sEngLang = \file_get_contents(LANGS_PATH.'/'.$sLangFile);
|
||||
return $sEngLang ? \parse_ini_string($sEngLang, true) : null;
|
||||
}
|
||||
|
||||
function mergeLangStructure($aFromLang, $aEngLang, &$iCount = 0)
|
||||
{
|
||||
$iCount = 0;
|
||||
foreach ($aEngLang as $sSectionKey => $aSectionValue)
|
||||
{
|
||||
foreach (\array_keys($aSectionValue) as $sParamKey)
|
||||
{
|
||||
if (isset($aFromLang[$sSectionKey][$sParamKey]))
|
||||
{
|
||||
$aEngLang[$sSectionKey][$sParamKey] = $aFromLang[$sSectionKey][$sParamKey];
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo $sSectionKey.'/'.$sParamKey.','."\n";
|
||||
$iCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aEngLang;
|
||||
}
|
||||
|
||||
function saveLangStructure($sLangFile, $aLang)
|
||||
{
|
||||
$aResultLines = array();
|
||||
$aResultLines[] = '; '.$sLangFile;
|
||||
|
||||
foreach ($aLang as $sSectionKey => $aSectionValue)
|
||||
{
|
||||
$aResultLines[] = '';
|
||||
$aResultLines[] = '['.$sSectionKey.']';
|
||||
|
||||
foreach ($aSectionValue as $sParamKey => $sParamValue)
|
||||
{
|
||||
$aResultLines[] = $sParamKey.' = "'.
|
||||
\str_replace(array('\\', '"'), array('\\\\', '\\"'), \trim($sParamValue)).'"';
|
||||
}
|
||||
}
|
||||
|
||||
\file_put_contents(LANGS_PATH.'/'.$sLangFile, implode("\n", $aResultLines));
|
||||
}
|
||||
|
||||
$sNL = "\n";
|
||||
$aEngLang = \getLangStructure('en.ini');
|
||||
|
||||
$aFiles = \glob(LANGS_PATH.'/*.ini');
|
||||
foreach ($aFiles as $sFile)
|
||||
{
|
||||
$iCount = 0;
|
||||
$sFileName = \basename($sFile);
|
||||
|
||||
$aNextLang = \getLangStructure($sFileName);
|
||||
$aNewLang = \mergeLangStructure($aNextLang, $aEngLang, $iCount);
|
||||
|
||||
if (\json_encode($aNextLang) === \json_encode($aNewLang))
|
||||
{
|
||||
echo $sFileName.': ok'.$sNL;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $sFileName.': changed ('.$iCount.')'.$sNL;
|
||||
}
|
||||
|
||||
// \saveLangStructure($sFileName, $aNewLang);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue