minor fix

This commit is contained in:
Xuan Sang LE 2018-03-17 23:46:37 +01:00
parent a111162e7b
commit 4290ea602a
3 changed files with 52 additions and 19 deletions

View File

@ -29,9 +29,10 @@ grep --include=\*.{coffee,tag} -roh "$1" -e '__("[^"]*"' | while read -r line ;
echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json"
fi
done
grep --include=\*.{coffee,html,tag} -roh "$1" -e '\"__\([^\"]*\)\"' | while read -r line; do
grep --include=\*.{coffee,html,tag} -roh "$1" -e '\"__([^\"]*)\"' | while read -r line; do
len=$(( ${#line} - 6 ))
#echo $len
#echo $line
SUBSTRING=${line:4:len}
#echo $SUBSTRING
if test -f "$2" && [ ! -z "$(grep -F "\"$SUBSTRING\":" "$2")" ]
@ -41,21 +42,26 @@ grep --include=\*.{coffee,html,tag} -roh "$1" -e '\"__\([^\"]*\)\"' | while read
echo -e "\t\"$SUBSTRING\":\"$SUBSTRING\"," >> "tmp.json"
fi
done
sort tmp.json > tmp1.json
awk '!a[$0]++' "tmp1.json" > tmp.json
sed '$ s/.$//' tmp.json > tmp1.json
# remove duplicate entry
if test -f $2
if test -f tmp.json
then
cp $2 "$2.old"
sed '$ s/.$//' $2 > tmp.json
cat tmp.json > $2
echo "," >> $2
cat tmp1.json >> $2
echo "}" >> "$2"
sort tmp.json > tmp1.json
awk '!a[$0]++' "tmp1.json" > tmp.json
sed '$ s/.$//' tmp.json > tmp1.json
# remove duplicate entry
if test -f $2
then
cp $2 "$2.old"
sed '$ s/.$//' $2 > tmp.json
cat tmp.json > $2
echo "," >> $2
cat tmp1.json >> $2
echo "}" >> "$2"
else
echo "{"> "$2"
cat tmp1.json >> "$2"
echo "}" >> "$2"
fi
rm tmp.json tmp1.json
else
echo "{"> "$2"
cat tmp1.json >> "$2"
echo "}" >> "$2"
fi
rm tmp.json tmp1.json
echo "Nothing change"
fi

View File

@ -255,4 +255,16 @@
"Please select an entry":"Vui lòng chọn 1 mục từ danh sách",
"Startup applications":"Ứng dụng khởi chạy",
"Startup services":"Dịch vụ khởi chạy"
,
"Cannot export to PNG in this browser: {0}":"Cannot export to PNG in this browser: {0}",
"Cannot export to {0}: {1}":"Cannot export to {0}: {1}",
"Cannot export: {0}":"Cannot export: {0}",
"Export as":"Export as",
"File exported":"File exported",
"Syntax error: {0}":"Syntax error: {0}"
,
"Graph editor":"Graph editor",
"Render":"Render"
}

View File

@ -246,6 +246,21 @@
"Edit mount point":"Sửa điểm truy cập"
,
"Services":"Services",
"Startup":"Startup"
"Services":"Dịch vụ",
"Startup":"Khởi chạy"
,
"Add application":"Thêm ứng dụng",
"Add service":"Thêm dịch vụ",
"Please select an entry":"Vui lòng chọn 1 mục từ danh sách",
"Startup applications":"Ứng dụng khởi chạy",
"Startup services":"Dịch vụ khởi chạy"
,
"Cannot export to PNG in this browser: {0}":"Cannot export to PNG in this browser: {0}",
"Cannot export to {0}: {1}":"Cannot export to {0}: {1}",
"Cannot export: {0}":"Cannot export: {0}",
"Export as":"Export as",
"File exported":"File exported",
"Syntax error: {0}":"Syntax error: {0}"
}