I wanna go through all the files and convert "xxx".localized()
into NSLocalizedString("xxx", comment: "")
This is what I have currently as part of a .sh
file
find ./[Directory] -name "*.swift" -print0 | while read -d $'\0' file
do
# fetches all .localized() e.g. "Hello world".localized()
instances=echo grep -R ".localized()" $file | awk -F "= " '{print $2}'
for instance in $instances
do
# this does nothing . . . ? also the "instance" that needs to be fed into the `NSLocalizedString` should actually
# be `instance | awk -F ".localized()" '{print $1}'` so that I just get "Hello world" but awk doesn't seem to work without the grep piping . . ?
sed -i "s/instance/NSLocalizedString(instance, comment: '')/g" "$file"
done
done