Files
opensourcepos/tools/ci4-upgrade-language-interpolation/sed_Common.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

16 lines
986 B
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
#Revereses changes previously made to files in en-US language.
echo -n "fixing en-US..."
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("copyrights")(.*?)(\{current_year\})(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("migration_needed")(.*?)(\{version\})(.*)/\1\2{0}\4/;' {} \;
echo -n "fixing others..."
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("copyrights")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;
find ${1}app/Language -type f -name Common.php -exec sed -i -E -e 's/("migration_needed")(.*?)(%1|٪1|1٪|1%|% 1|٪ 1)(.*)/\1\2{0}\4/;' {} \;