Files
opensourcepos/tools/ci4-upgrade-language-interpolation/sed_Items.sh
Doug Hutcheson 1a465621e0 Ci4 bugfix string interpolation (#3836)
* CI4: Bugfix string interpolation language files

These are the language files with all placeholders converted to CI4 numbered style eg {0}.

* CI4: Bugfix string interpolation source code files

These are the controllers and views which call lang() with parameters to be interpolated.

* CI4: Bugfix string interpolation shell scripts

These are the Linux bash scripts which use the sed (stream editor) utility to convert earlier forms of placeholders to CI4 numeric type. A number of typographical errors in the original Language files were corrected by these scripts.
2024-06-15 17:19:15 +02:00

19 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/bash
#This Linux bash script is part of OSPOS CI4 Upgrade
#Developed and tested on Fedora 38
#Converts CI3 %x parameters into CI4 {x} parameters
#Multiple parameters must be processed individually to ensure
#correct handling of parameters in different positions depending
#upon whether the language is L to R or R to L
#This script handles an R to L typo which had the parameters entered as
#1% and 2% instead of %1 and %2 in two languages.
#The %1 rendered on screen as %1, but copied and pasted as 1% which was very confusing
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(\{count\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(\{failures\})(.*)/\1\2{1}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Items.php -exec sed -i -E -e 's/("csv_import_partially_failed")(.*?)(%2|٪2|2٪|2%|% 2|٪ 2)(.*)/\1\2{1}\4/;' {} \;