Improving translations update script.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c32d70e9ed
commit
c806f09b10
1 changed files with 12 additions and 5 deletions
|
@ -4,7 +4,7 @@
|
|||
# specificities so that lupdate doesn't cry out in pain.
|
||||
# See also: https://bugreports.qt.io/browse/QTBUG-123819
|
||||
#
|
||||
|
||||
|
||||
escape() {
|
||||
str="$1"
|
||||
str="${str//\//\\/}" # Escape slashes
|
||||
|
@ -19,15 +19,20 @@ replace() {
|
|||
sed -i "s/${from}/${to}/g" "$file"
|
||||
}
|
||||
|
||||
rm ../qml/eu/ad5001/LogarithmPlotter/js/index.mjs # Remove index which should not be scanned
|
||||
|
||||
files=$(find .. -name *.mjs)
|
||||
for file in $files; do
|
||||
echo "Moving '$file' to '${file%.*}.js'..."
|
||||
mv "$file" "${file%.*}.js"
|
||||
# Replacements to make it valid js
|
||||
replace "${file%.*}.js" "^import" "/*import"
|
||||
replace "${file%.*}.js" "^export *" "/*export *"
|
||||
replace "${file%.*}.js" '.mjs"$' '.mjs"*/'
|
||||
replace "${file%.*}.js" "^export default" "/*export default*/"
|
||||
replace "${file%.*}.js" "^export" "/*export*/"
|
||||
replace "${file%.*}.js" "async " "/*async */"
|
||||
replace "${file%.*}.js" "await" "/*await */"
|
||||
done
|
||||
|
||||
echo "----------------------------"
|
||||
|
@ -38,7 +43,6 @@ lupdate -extensions js,qs,qml,py -recursive .. -ts lp_*.ts
|
|||
for lp in *.ts; do
|
||||
echo "Replacing locations in $lp..."
|
||||
for file in $files; do
|
||||
echo " > Replacing for file $file..."
|
||||
replace "$lp" "${file%.*}.js" "$file"
|
||||
done
|
||||
done
|
||||
|
@ -47,8 +51,11 @@ for file in $files; do
|
|||
echo "Moving '${file%.*}.js' to '$file'..."
|
||||
mv "${file%.*}.js" "$file"
|
||||
# Resetting changes
|
||||
replace "$file" "^/*import" "import"
|
||||
replace "$file" '.mjs"*/$' '.mjs"'
|
||||
replace "$file" "^/*export default*/" "export default"
|
||||
replace "$file" "/*await */" "await"
|
||||
replace "$file" "/*async */" "async "
|
||||
replace "$file" "^/*export*/" "export"
|
||||
replace "$file" "^/*export default*/" "export default"
|
||||
replace "$file" "^/*import" "import"
|
||||
replace "$file" "^/*export" "export"
|
||||
replace "$file" '.mjs"*/$' '.mjs"'
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue