-
Notifications
You must be signed in to change notification settings - Fork 1
/
Affin-ko
executable file
·57 lines (51 loc) · 2.18 KB
/
Affin-ko
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
DICPATH=~/Affin.ko/.affin.ko.dictionary
case $1 in
"Designer")
APPNAME=Affinity\ Designer\ 2
;;
"Photo")
APPNAME=Affinity\ Photo\ 2
;;
"Publisher")
APPNAME=Affinity\ Publisher\ 2
;;
*)
echo "사용법:"
echo " Affin-ko application_name"
echo "예시:"
echo " Affin-ko Designer"
echo " Affin-ko Photo"
echo " Affin-ko Publisher"
exit
;;
esac
printf "\n→ App 위치 변경\n"
sudo mv /Applications/"${APPNAME}".app ~/Applications/
echo "각주) No such file or directory : <정상>입니다."
printf "\n→ ko.lproj 폴더를 생성합니다.\n"
mkdir ~/Applications/"${APPNAME}".app/Contents/Resources/ko.lproj
mkdir ~/Applications/"${APPNAME}".app/Contents/Frameworks/libcocoaui.framework/Versions/A/Resources/ko.lproj
echo "각주) File exists : <정상>입니다."
printf "\n→ Check Update\n"
cd ~/Affin.ko/
git pull
ENGPATH=~/Applications/"${APPNAME}".app/Contents/Resources/en-US.lproj/
KORPATH=~/Applications/"${APPNAME}".app/Contents/Resources/ko.lproj/
FILECOUNT=$(ls -a "${ENGPATH}" | grep "strings" | sed -n "=" | tail -n "1")
for ((i = 1; i <= ${FILECOUNT}; i++)); do
FILENAME=$(/bin/ls "${ENGPATH}" | /usr/bin/sed -n "${i}p")
sudo printf "총 ${FILECOUNT}개 파일 중에서 ${i}번째 파일을 변환합니다.\n→ 파일 이름: ${FILENAME}"
sudo iconv -f UTF-16LE -t UTF-8 "${ENGPATH}${FILENAME}" >"${KORPATH}${FILENAME}.temp"
sudo sed -f "${DICPATH}" "${KORPATH}${FILENAME}.temp" >"${KORPATH}${FILENAME}"
printf " (완료)\n"
done
ENGFPATH=~/Applications/"${APPNAME}".app/Contents/Frameworks/libcocoaui.framework/Versions/A/Resources/en-US.lproj/
KORFPATH=~/Applications/"${APPNAME}".app/Contents/Frameworks/libcocoaui.framework/Versions/A/Resources/ko.lproj/
FILECOUNT=$(ls -a "${ENGFPATH}" | grep "strings" | sed -n "=" | tail -n "1")
for ((i = 1; i <= ${FILECOUNT}; i++)); do
FILENAME=$(/bin/ls "${ENGFPATH}" | /usr/bin/sed -n "${i}p")
sudo printf "총 ${FILECOUNT}개 파일 중에서 ${i}번째 파일을 변환합니다.\n→ 파일 이름: ${FILENAME}"
sudo iconv -f UTF-16LE -t UTF-8 "${ENGFPATH}${FILENAME}" >"${KORFPATH}${FILENAME}.temp"
sudo sed -f "${DICPATH}" "${KORFPATH}${FILENAME}.temp" >"${KORFPATH}${FILENAME}"
printf " (완료)\n"
done