# read out the locations from the file
FileOpen $R5 "$INSTDIR\Resources\HunspellDictionaryNames.txt" r
- ${For} $5 1 114
+ ${For} $5 1 132 # the file has 132 lines
+
FileRead $R5 $String # $String is now the dictionary name
- StrCpy $R3 $String 5 # $R3 is now the dictionary language code
+ StrCpy $R3 $String -6 # $R3 is now the dictionary language code
${if} $DictCode == $R3
StrCpy $String $String -2 # delete the linebreak characters at the end
# 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
+ ${For} $5 1 44 # the file has 44 lines
+
+ FileRead $R5 $String # $String is now the dictionary name
StrCpy $R3 $String 5 3 # $R3 is now the dictionary language code
${if} $ThesCode == $R3
#--------------------------------
Function InstallHunspellDictionary
- # install hunspell dictionaries
+ # install the selected hunspell dictionaries except of already existing ones
- # 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
+ # download the dictionaries
${Do}
- StrCpy $DictCode $DictCodes 5
- StrCpy $DictCodes $DictCodes "" 5
- Call DownloadHunspellDictionary
+ # take the first code
+ StrCpy $Search ","
+ StrCpy $String $DictCodes
+ Call StrPoint
+ ${if} $Pointer != "-1"
+ StrCpy $DictCode $DictCodes $Pointer
+ # remove the taken code from the list
+ IntOp $Pointer $Pointer + 1
+ StrCpy $DictCodes $DictCodes "" $Pointer
+ ${endif}
+ # don't dowload existing ones thus check if $DictCode is in $FoundDict
+ StrCpy $String $FoundDict
+ StrCpy $Search $DictCode
+ Call StrPoint # function from LyXUtils.nsh
+ ${if} $Pointer == "-1"
+ Call DownloadHunspellDictionary
+ ${endif}
${LoopUntil} $DictCodes == ""
- # some dictionaries need to be renamed
- ${if} ${FileExists} "$INSTDIR\Resources\dicts\db_DE.aff"
- Rename "$INSTDIR\Resources\dicts\db_DE.aff" "$INSTDIR\Resources\dicts\dsb_DE.aff"
- Rename "$INSTDIR\Resources\dicts\db_DE.dic" "$INSTDIR\Resources\dicts\dsb_DE.dic"
- ${endif}
- ${if} ${FileExists} "$INSTDIR\Resources\dicts\hb_DE.aff"
- Rename "$INSTDIR\Resources\dicts\hb_DE.aff" "$INSTDIR\Resources\dicts\hsb_DE.aff"
- Rename "$INSTDIR\Resources\dicts\hb_DE.dic" "$INSTDIR\Resources\dicts\hsb_DE.dic"
- ${endif}
-
FunctionEnd
#--------------------------------
Function InstallThesaurusDictionary
- # install thesaurus dictionaries
+ # install the selected thesaurus dictionaries except of already existing ones
- # 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
+ # download the dictionaries
${Do}
- StrCpy $ThesCode $ThesCodes 5
- StrCpy $ThesCodes $ThesCodes "" 5
- Call DownloadThesaurusDictionary
+ # all codes have 5 characters
+ StrCpy $ThesCode $ThesCodes 5 # take the first code
+ StrCpy $ThesCodes $ThesCodes "" 5 # remove the taken code from the list
+ # don't dowload existing ones thus check if $ThesCode is in $FoundThes
+ StrCpy $String $FoundThes
+ StrCpy $Search $ThesCode
+ Call StrPoint # function from LyXUtils.nsh
+ ${if} $Pointer == "-1"
+ Call DownloadThesaurusDictionary
+ ${endif}
${LoopUntil} $ThesCodes == ""
# some dictionaries of language variants are identic