Clean code

This commit is contained in:
Laurent Destailleur 2021-08-17 23:23:15 +02:00
parent bbcea38793
commit c001fb9555
4 changed files with 30 additions and 2175 deletions

View File

@ -50,6 +50,10 @@ then
then then
aaupper="SA" aaupper="SA"
fi fi
if [ $bb = "IQ" ]
then
aaupper="SA"
fi
bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'` bblower=`echo $dirshort | nawk -F"_" '{ print tolower($2) }'`
@ -60,23 +64,26 @@ then
echo $reflang" "$aa"_"$bb != $aa"_"$aaupper echo $reflang" "$aa"_"$bb != $aa"_"$aaupper
# If $reflang is a main language to use to sanitize the alternative file # If $reflang is a main language to use to sanitize the alternative file
if [ -d $reflang -a $aa"_"$bb != $aa"_"$aaupper ] if [ -d $reflang ]
then then
echo "***** Search original into "$reflang if [ $aa"_"$bb != $aa"_"$aaupper ]
echo $dirshort is an alternative language of $reflang then
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 echo "***** Search original into "$reflang
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 echo $dirshort is an alternative language of $reflang
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`; ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
do f=`cat $fic | wc -l`; for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done
#echo $f lines into file $fic; for fic in `ls htdocs/langs/${aa}_${bb}/*.lang`;
if [ $f = 1 ] do f=`cat $fic | wc -l`;
then #echo $f lines into file $fic;
echo Only one line remainging into file $fic, we delete it; if [ $f = 1 ]
rm $fic then
fi; echo Only one line remainging into file $fic, we delete it;
done rm $fic
fi fi;
done
fi
fi
fi fi
done; done;
fi fi

View File

@ -177,7 +177,7 @@ foreach ($filesToProcess as $fileToProcess) {
// Start reading and parsing English // Start reading and parsing English
$aEnglish = array();
if ($handle = fopen($lEnglishFile, 'r')) { if ($handle = fopen($lEnglishFile, 'r')) {
print "Read English File $lEnglishFile:\n"; print "Read English File $lEnglishFile:\n";
$cnt = 0; $cnt = 0;
@ -246,6 +246,9 @@ foreach ($filesToProcess as $fileToProcess) {
fwrite($oh, "# Dolibarr language file - Source file is en_US - ".(preg_replace('/\.lang$/', '', $fileToProcess))."\n"); fwrite($oh, "# Dolibarr language file - Source file is en_US - ".(preg_replace('/\.lang$/', '', $fileToProcess))."\n");
$fileFirstFound = array();
$lineFirstFound = array();
$cnt = 0; $cnt = 0;
while (($line = fgets($handle)) !== false) { while (($line = fgets($handle)) !== false) {
$cnt++; $cnt++;
@ -299,6 +302,7 @@ foreach ($filesToProcess as $fileToProcess) {
} }
// String exists in both files and value into alternative language differs from main language but also from english files // String exists in both files and value into alternative language differs from main language but also from english files
// so we keep it.
if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key] if ((! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key]) && ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])
|| in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key) || in_array($key, $arrayofkeytoalwayskeep) || preg_match('/^FormatDate/', $key) || preg_match('/^FormatHour/', $key)

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ DIRECTION=ltr
FONTFORPDF=helvetica FONTFORPDF=helvetica
FONTSIZEFORPDF=10 FONTSIZEFORPDF=10
SeparatorDecimal=. SeparatorDecimal=.
SeparatorThousand=, SeparatorThousand=None
FormatDateShort=%m/%d/%Y FormatDateShort=%m/%d/%Y
FormatDateShortInput=%m/%d/%Y FormatDateShortInput=%m/%d/%Y
FormatDateShortJava=MM/dd/yyyy FormatDateShortJava=MM/dd/yyyy