Last active
May 5, 2020 11:44
-
-
Save Kaabi/9105205deb702ec8118d0ecca5e87512 to your computer and use it in GitHub Desktop.
Inserting New Language variable name & value into Codeigniter multiple languages folders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
[ -z $1 ] && echo "Language file name is missing" && exit 1 | |
[ -z $2 ] && echo "Language variable name is missing" && exit 1 | |
[ -z "$3" ] && echo "Language variable value is missing" && exit 1 | |
for i in $(find . -maxdepth 1 -mindepth 1 -type d); do | |
if ! [ -z "$(tail -c 1 "$i/$1_lang.php")" ]; then | |
echo "\n" >>$i/$1_lang.php | |
fi | |
echo "\$lang['"$2"'] = '"$3"';" >>$i/$1_lang.php | |
echo "Edited" $i/$1_lang.php | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
copy add-new-lang-string.sh into Codeigniter application/languages folder
Example Usage: ./add-new-lang-string.sh email new_error_msg 'Hello World!'