SectionEnd
!endif
+SectionGroup "Dictionaries" SecDictionaries
+
+Section /o "German (A)" SecDGermanAT
+ StrCpy $DictCodes "de_AT$DictCodes"
+ AddSize 1000
+SectionEnd
+
+Section /o "German (CH)" SecDGermanCH
+ StrCpy $DictCodes "de_CH$DictCodes"
+ AddSize 1000
+SectionEnd
+
+Section "German (D)" SecDGermanD
+ StrCpy $DictCodes "de_DE$DictCodes"
+ AddSize 2650
+SectionEnd
+
+Section "Magyar" SecDHungarian
+ StrCpy $DictCodes "hu_HU$DictCodes"
+ AddSize 3380
+SectionEnd
+
+Section "Serb\9acina" SecDSorbian
+ StrCpy $DictCodes "db_DE$DictCodes"
+ AddSize 904
+SectionEnd
+
+SectionGroupEnd
+
+SectionGroup "Thesaurus" SecThesaurus
+
+Section /o "Bulgarian" SecTBulgarian
+ StrCpy $ThesCodes "bg_BG$ThesCodes"
+ AddSize 3020
+SectionEnd
+
+Section /o "Català" SecTCatalan
+ StrCpy $ThesCodes "ca_ES$ThesCodes"
+ AddSize 731
+SectionEnd
+
+Section /o "Ce\9atina" SecTCzech
+ StrCpy $ThesCodes "cs_CZ$ThesCodes"
+ AddSize 635
+SectionEnd
+
+Section /o "Dansk" SecTDanish
+ StrCpy $ThesCodes "da_DK$ThesCodes"
+ AddSize 2360
+SectionEnd
+
+Section /o "Deutsch (D/A)" SecTGermanDA
+ StrCpy $ThesCodes "de_DE$ThesCodes"
+ AddSize 5360
+SectionEnd
+
+Section /o "Deutsch (CH)" SecTGermanCH
+ StrCpy $ThesCodes "de_CH$ThesCodes"
+ AddSize 5360
+SectionEnd
+
+Section /o "English (GB)" SecTEnglishGB
+ StrCpy $ThesCodes "en_GB$ThesCodes"
+ AddSize 20600
+SectionEnd
+
+Section /o "English (US/AU)" SecTEnglishUSAU
+ StrCpy $ThesCodes "en_US$ThesCodes"
+ AddSize 20600
+SectionEnd
+
+Section /o "Español" SecTSpanish
+ StrCpy $ThesCodes "es_ES$ThesCodes"
+ AddSize 2860
+SectionEnd
+
+Section /o "Français" SecTFrench
+ StrCpy $ThesCodes "fr_FR$ThesCodes"
+ AddSize 5060
+SectionEnd
+
+Section /o "Gaeilge" SecTGaelic
+ StrCpy $ThesCodes "ga_IR$ThesCodes"
+ AddSize 30600
+SectionEnd
+
+Section /o "Greek" SecTGreek
+ StrCpy $ThesCodes "el_GR$ThesCodes"
+ AddSize 903
+SectionEnd
+
+Section /o "Italiano" SecTItalian
+ StrCpy $ThesCodes "it_IT$ThesCodes"
+ AddSize 2640
+SectionEnd
+
+Section /o "Magyar" SecTHungarian
+ StrCpy $ThesCodes "hu_HU$ThesCodes"
+ AddSize 632
+SectionEnd
+
+Section /o "Norsk" SecTNorwegian
+ StrCpy $ThesCodes "no_NO$ThesCodes"
+ AddSize 2470
+SectionEnd
+
+Section /o "Polski" SecTPolish
+ StrCpy $ThesCodes "pl_PL$ThesCodes"
+ AddSize 5580
+SectionEnd
+
+Section /o "Português" SecTPortuguese
+ StrCpy $ThesCodes "pt_PT$ThesCodes"
+ AddSize 855
+SectionEnd
+
+Section /o "Româna" SecTRomanian
+ StrCpy $ThesCodes "ro_RO$ThesCodes"
+ AddSize 3640
+SectionEnd
+
+Section /o "Russian" SecTRussian
+ StrCpy $ThesCodes "ru_RU$ThesCodes"
+ AddSize 2080
+SectionEnd
+
+Section /o "Sloven\9acina" SecTSlowenian
+ StrCpy $ThesCodes "sl_SI$ThesCodes"
+ AddSize 107
+SectionEnd
+
+Section /o "Slovenský" SecTSlowakian
+ StrCpy $ThesCodes "sk_SK$ThesCodes"
+ AddSize 907
+SectionEnd
+
+Section /o "Svenska" SecTSwedish
+ StrCpy $ThesCodes "sv_SE$ThesCodes"
+ AddSize 720
+SectionEnd
+
+SectionGroupEnd
+
# Section descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
--- /dev/null
+# download dictionaries
+
+Function DownloadHunspellDictionary
+ # Downloads hunspell dictionaries from a location that is given in the file
+ # $INSTDIR\Resources\HunspellDictionaryNames.txt
+
+ # read out the locations from the file
+ FileOpen $R5 "$INSTDIR\Resources\HunspellDictionaryNames.txt" r
+ ${For} $5 1 114
+ FileRead $R5 $String # $String is now the dictionary name
+ StrCpy $R3 $String 5 3 # $R3 is now the dictionary language code
+ MessageBox MB_OK|MB_ICONEXCLAMATION "$R3"
+
+ ${if} $DictCode == $R3
+ StrCpy $String $String -2 # delete the linebreak characters at the end
+ StrCpy $FileName $String 15 # extract the real file name
+ # Download hunspell dictionaries,
+ # if first download repository is not available try the other ones listed in "DictionaryMirrors.txt"
+ FileOpen $R4 "$INSTDIR\Resources\DictionaryMirrors.txt" r
+
+ ${For} $4 1 5
+ FileRead $R4 $Search # $Search is now the mirror
+ StrCpy $Search $Search -2 # delete the linebreak characters at the end
+ Push $R0
+ MessageBox MB_OK|MB_ICONEXCLAMATION "http://downloads.sourceforge.net/project/lyxwininstaller/thesaurus/$String&use_mirror=$Search"
+ InetLoad::load /TIMEOUT=5000 "http://downloads.sourceforge.net/project/lyxwininstaller/thesaurus/$String&use_mirror=$Search" "$INSTDIR\Resources\dicts\$FileName" /END
+ Pop $R0
+ ${if} $R0 == "OK"
+ ${ExitFor}
+ ${endif}
+ ${Next}
+
+ FileClose $R4
+ # if download failed
+ ${if} $R0 != "OK"
+ MessageBox MB_OK|MB_ICONEXCLAMATION "(AspellDownloadFailed) $R0"
+ Goto abortinstall
+ ${endif}
+ ${endif} # end if $DictCode == $R3
+
+ ${Next}
+ FileClose $R5
+
+ abortinstall:
+ Delete "$INSTDIR\$FileName"
+
+FunctionEnd
+
+#--------------------------------
+
+Function DownloadThesaurusDictionary
+ # Downloads thesaurus dictionaries from a location that is given in the file
+ # $INSTDIR\Resources\ThesaurusDictionaryNames.txt
+
+ # read out the locations from the file
+ FileOpen $R5 "$INSTDIR\Resources\ThesaurusDictionaryNames.txt" r
+ ${For} $5 1 44
+ FileRead $R5 $String # $String is now the dictionary name
+ StrCpy $R3 $String 5 3 # $R3 is now the dictionary language code
+
+ ${if} $ThesCode == $R3
+ StrCpy $String $String -2 # delete the linebreak characters at the end
+ StrCpy $FileName $String 15 # extract the real file name
+ # Download thesaurus dictionaries,
+ # if first download repository is not available try the other ones listed in "DictionaryMirrors.txt"
+ FileOpen $R4 "$INSTDIR\Resources\DictionaryMirrors.txt" r
+
+ ${For} $4 1 5
+ FileRead $R4 $Search # $Search is now the mirror
+ StrCpy $Search $Search -2 # delete the linebreak characters at the end
+ Push $R0
+ MessageBox MB_OK|MB_ICONEXCLAMATION "http://downloads.sourceforge.net/project/lyxwininstaller/thesaurus/$String&use_mirror=$Search"
+ InetLoad::load /TIMEOUT=5000 "http://downloads.sourceforge.net/project/lyxwininstaller/thesaurus/$String&use_mirror=$Search" "$INSTDIR\Resources\thes\$FileName" /END
+ Pop $R0
+ ${if} $R0 == "OK"
+ ${ExitFor}
+ ${endif}
+ ${Next}
+
+ FileClose $R4
+ # if download failed
+ ${if} $R0 != "OK"
+ MessageBox MB_OK|MB_ICONEXCLAMATION "(AspellDownloadFailed) $R0"
+ Goto abortinstall
+ ${endif}
+ ${endif} # end if $ThesCode == $R3
+
+ ${Next}
+ FileClose $R5
+
+ abortinstall:
+ Delete "$INSTDIR\$FileName"
+
+FunctionEnd
+
+#--------------------------------
+
+Function InstallHunspellDictionary
+ # install hunspell dictionaries
+
+ # install the dictionary corresponding to the system and the chosen menu language
+ # check if the system language and the chosen menu language are the same, if not install
+ # both dictionaries
+ ${Do}
+ StrCpy $DictCode $DictCodes 5
+ StrCpy $DictCodes $DictCodes "" 5
+ MessageBox MB_OK|MB_ICONEXCLAMATION "$DictCode"
+ Call DownloadHunspellDictionary
+ ${LoopUntil} $DictCodes == ""
+
+FunctionEnd
+
+#--------------------------------
+
+Function InstallThesaurusDictionary
+ # install thesaurus dictionaries
+
+ # install the dictionary corresponding to the system and the chosen menu language
+ # check if the system language and the chosen menu language are the same, if not install
+ # both dictionaries
+ ${Do}
+ StrCpy $ThesCode $ThesCodes 5
+ StrCpy $ThesCodes $ThesCodes "" 5
+ MessageBox MB_OK|MB_ICONEXCLAMATION "$ThesCode"
+ Call DownloadThesaurusDictionary
+ ${LoopUntil} $ThesCodes == ""
+
+ # some dictionaries of language variants are identic
+ # therefore copy and rename an existing dictionary
+ CreateDirectory "$INSTDIR\Resources\backup"
+ ${if} ${FileExists} "$INSTDIR\Resources\thes\th_de_DE_v2.dat"
+ CopyFiles "$INSTDIR\Resources\thes\th_de_DE_v2.*" "$INSTDIR\Resources\backup"
+ Rename "$INSTDIR\Resources\backup\th_de_DE_v2.dat" "$INSTDIR\Resources\backup\th_de_AT_v2.dat"
+ Rename "$INSTDIR\Resources\backup\th_de_DE_v2.idx" "$INSTDIR\Resources\backup\th_de_AT_v2.idx"
+ CopyFiles "$INSTDIR\Resources\backup\th_de_AT_v2.*" "$INSTDIR\Resources\thes"
+ ${endif}
+ ${if} ${FileExists} "$INSTDIR\Resources\thes\th_en_US_v2.dat"
+ CopyFiles "$INSTDIR\Resources\thes\th_en_US_v2.*" "$INSTDIR\Resources\backup"
+ Rename "$INSTDIR\Resources\backup\th_en_US_v2.dat" "$INSTDIR\Resources\backup\th_en_AU_v2.dat"
+ Rename "$INSTDIR\Resources\backup\th_en_US_v2.idx" "$INSTDIR\Resources\backup\th_en_AU_v2.idx"
+ CopyFiles "$INSTDIR\Resources\backup\th_en_AU_v2.*" "$INSTDIR\Resources\thes"
+ ${endif}
+ RMDir "$INSTDIR\Resources\backup"
+
+FunctionEnd