Skip to content

Commit

Permalink
v1.0.8 read language-codes from ini file
Browse files Browse the repository at this point in the history
  • Loading branch information
emisjerry committed Mar 5, 2021
1 parent 1a2729c commit 0cf8e32
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 6 deletions.
37 changes: 31 additions & 6 deletions autosub-ahk.ahk
Binary file modified autosub-ahk.exe
Binary file not shown.
49 changes: 49 additions & 0 deletions autosub-ahk.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[LANGUAGES]
1=zh_TW
2=zh_CN
3=en_US
count=11

; number=LanguageCode LanguageDescription
; How to get the required language code?
; 1. Execute cmd.exe
; 2. cd autosub
; 3. autosub.exe -lsc
[zh_TW]
1=zh-TW 中文(繁體)
2=zh-CN 中文(簡體)
3=en-US English
4=ja-JP 日本語
5=ko-KR 한국어
6=yue-hant-hk 粵語
7=fr-fr French(法語)
8=tr-tr Turkish (土耳其語)
9=ru-ru Russian (俄語)
10=es-es Spanish (西班牙語)
11=it-it Italian (義大利語)

[zh_CN]
1=zh-TW 中文(繁体)
2=zh-CN 中文(简体)
3=en-US English
4=ja-JP 日本语
5=ko-KR 한국어
6=yue-hant-hk 粤语
7=fr-fr French(法语)
8=tr-tr Turkish (土耳其语)
9=ru-ru Russian (俄语)
10=es-es Spanish (西班牙语)
11=it-it Italian (意大利语)

[en_US]
1=zh-TW Chinese(Traditional)
2=zh-CN Chinese(Simplified)
3=en-US English
4=ja-JP Japanese
5=ko-KR Korean
6=yue-hant-hk Hong Kong
7=fr-fr French(France)
8=tr-tr Turkish (Turkey)
9=ru-ru Russian (Russia)
10=es-es Spanish (Spain)
11=it-it Italian (Italy)
30 changes: 30 additions & 0 deletions read-ini.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

; https://autohotkey.com/board/topic/33506-read-ini-file-in-one-go/

ReadIni( filename = 0 )
; Read a whole .ini file and creates variables like this:
; %Section%%Key% = %value%
{
Local s, c, p, key, k

if not filename
filename := SubStr( A_ScriptName, 1, -3 ) . "ini"

FileRead, s, %filename%

Loop, Parse, s, `n`r, %A_Space%%A_Tab%
{
c := SubStr(A_LoopField, 1, 1)
if (c="[")
key := SubStr(A_LoopField, 2, -1)
else if (c=";")
continue
else {
p := InStr(A_LoopField, "=")
if p {
k := SubStr(A_LoopField, 1, p-1)
%key%%k% := SubStr(A_LoopField, p+1)
}
}
}
}

0 comments on commit 0cf8e32

Please sign in to comment.