#!/bin/bash
source $HOME/.gamerc

for multi_lang_directory in $(cat ${HOME}/.gamerc | grep TRANSLATED_INI_UPLOAD_DIR_ | grep -v '#' | awk -F"=" '{print $2}'); do
	LCOUNTRY=$(echo ${multi_lang_directory} | sed 's/"//g' | awk -F"/" '{print $(NF-1)}' | awk -F"_" '{print $NF}')
	COUNTRY=$(echo ${LCOUNTRY} | tr '[:lower:]' '[:upper:]')
	TRANSLATE_DIRECTORY=$(echo ${multi_lang_directory} | sed 's/"//g')
	FILELIST_NAME="FullGameDataTranslateFileList_${LCOUNTRY}.txt"
	OUTPUT_FILELIST_NAME="FullGameDataTranslateFileList_${GAME_TYPE}${COUNTRY_CODE_DISPLAY}_${LCOUNTRY}.txt"

	#echo "${COUNTRY} => ${TRANSLATE_DIRECTORY}"
	cd ${TRANSLATE_DIRECTORY}
	cat ${FILELIST_NAME} | awk -F"," '{print $1","$2","$3$9}' > $HOME/bin/${OUTPUT_FILELIST_NAME}
	sed -i '1d' $HOME/bin/${OUTPUT_FILELIST_NAME}
done
