Skip to content

Commit

Permalink
Ship en_US hunspell dictionaries on Windows and OSX
Browse files Browse the repository at this point in the history
For now, this uses the same OpenOffice dictionaries that were used in
previous official releases, downloaded from
https://sourceforge.net/projects/openofficeorg.mirror/files/contrib/dictionaries/
In the future this could be updated to some newer dictionary like
SCOWL's.

Fixes arch1t3cht#21.
  • Loading branch information
arch1t3cht committed Dec 3, 2023
1 parent 8e084bb commit 16f2183
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/win_installer/fragment_spelling.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; This file declares all installables related to spell checking and thesaurii in Aegisub

[Files]
Source: {#DEPS_DIR}\dictionaries\en_US.aff; DestDir: {app}\dictionaries; Flags: skipifsourcedoesntexist ignoreversion

This comment has been minimized.

Copy link
@CoffeeFlux

CoffeeFlux Dec 3, 2023

Member

Why aren't we skipping this? The dicts should be optional, right?

This comment has been minimized.

Copy link
@arch1t3cht

arch1t3cht Dec 3, 2023

Author Member

True. I originally put this in so that the ci would properly fail when the dicts couldn't be downloaded, but that should be done in the setup script instead. I'll update it.

Source: {#DEPS_DIR}\dictionaries\en_US.dic; DestDir: {app}\dictionaries; Flags: skipifsourcedoesntexist ignoreversion
Source: {#DEPS_DIR}\dictionaries\en_US.aff; DestDir: {app}\dictionaries; Flags: ignoreversion; Components: dictionaries/en_US
Source: {#DEPS_DIR}\dictionaries\en_US.dic; DestDir: {app}\dictionaries; Flags: ignoreversion; Components: dictionaries/en_US
3 changes: 3 additions & 0 deletions packages/win_installer/portable/create-portable.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ Copy-New-Item $InstallerDir\bin\aegisub.exe $PortableOutputDir

Write-Output 'Copying - translations'
Copy-New-Items "$InstallerDir\share\locale\*" "$PortableOutputDir\locale" -Recurse
Write-Output 'Copying - dictionaries'
Copy-New-Item $InstallerDepsDir\dictionaries\en_US.aff $PortableOutputDir\dictionaries
Copy-New-Item $InstallerDepsDir\dictionaries\en_US.dic $PortableOutputDir\dictionaries
Write-Output 'Copying - codecs'
Write-Output 'Copying - codecs\Avisynth'
Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x64\Output\system\DevIL.dll $PortableOutputDir
Expand Down
9 changes: 8 additions & 1 deletion tools/osx-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ echo "---- Copying dictionaries ----"
if test -f "${DICT_DIR}"; then
cp -v "${DICT_DIR}/*" "${PKG_DIR}/Contents/SharedSupport/dictionaries"
else
echo "Specified dictionary directory ${DICT_DIR} not found!"
mkdir -p "${BUILD_DIR}/dictionaries"
if ! test -f "${BUILD_DIR}/dictionaries/en_US.aff"; then
echo "Specified dictionary directory ${DICT_DIR} not found. Downloading dictionaries:"
curl -L "https://downloads.sourceforge.net/project/openofficeorg.mirror/contrib/dictionaries/en_US.zip" -o "${BUILD_DIR}/dictionaries/en_US.zip"
unzip "${BUILD_DIR}/dictionaries/en_US.zip" -d "${BUILD_DIR}/dictionaries"
fi
cp -v "${BUILD_DIR}/dictionaries/en_US.aff" "${PKG_DIR}/Contents/SharedSupport/dictionaries"
cp -v "${BUILD_DIR}/dictionaries/en_US.dic" "${PKG_DIR}/Contents/SharedSupport/dictionaries"
fi

echo
Expand Down
9 changes: 8 additions & 1 deletion tools/win-installer-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ if (!(Test-Path VC_redist)) {
Invoke-WebRequest https://aka.ms/vs/17/release/VC_redist.x64.exe -OutFile "$redistDir\VC_redist.x64.exe" -UseBasicParsing
}

# TODO dictionaries
# dictionaries
if (!(Test-Path dictionaries)) {
New-Item -ItemType Directory dictionaries
[Net.ServicePointManager]::SecurityProtocol = "Tls12" # Needed since otherwise downloading fails in some places like on the GitHub CI: https://stackoverflow.com/a/66614041/4730656
Invoke-WebRequest https://downloads.sourceforge.net/project/openofficeorg.mirror/contrib/dictionaries/en_US.zip -UserAgent "Wget" -OutFile en_US.zip -UseBasicParsing
Expand-Archive -LiteralPath en_US.zip -DestinationPath dictionaries
Remove-Item en_US.zip
}

# localization
Set-Location $BuildRoot
Expand Down

0 comments on commit 16f2183

Please sign in to comment.