summaryrefslogtreecommitdiffstats
path: root/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh
parentInitial commit. (diff)
downloadthunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.tar.xz
thunderbird-9e3c08db40b8916968b9f30096c7be3f00ce9647.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh')
-rwxr-xr-xextensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh
new file mode 100755
index 0000000000..9e2f37a16f
--- /dev/null
+++ b/extensions/spellcheck/locales/en-US/hunspell/dictionary-sources/install-new-dict.sh
@@ -0,0 +1,47 @@
+#! /usr/bin/env sh
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This script copies the new dictionary created by make-new-dict in
+# place.
+
+set -e
+
+WKDIR="`pwd`"
+SUPPORT_DIR="$WKDIR/support_files"
+SPELLER="$WKDIR/scowl/speller"
+
+# Stop if backup folders already exist, because it means that this script
+# has already been run once.
+FOLDERS=( "orig-bk" "mozilla-bk")
+for f in ${FOLDERS[@]}; do
+ if [ -d "$SUPPORT_DIR/$f" ]; then
+ echo "Backup folder already present: $f"
+ echo "Run make-new-dict.sh before running this script."
+ exit 1
+ fi
+done
+
+mv orig "$SUPPORT_DIR/orig-bk"
+mkdir orig
+cp $SPELLER/en_US-custom.dic $SPELLER/en_US-custom.aff $SPELLER/README_en_US-custom.txt orig
+
+mkdir "$SUPPORT_DIR/mozilla-bk"
+mv ../en-US.dic ../en-US.aff ../README_en_US.txt "$SUPPORT_DIR/mozilla-bk"
+
+# The affix file is ISO-8859-1, but still need to change the character set to
+# ISO-8859-1 and remove conversion rules.
+cp en_US-mozilla.aff utf8/en-US-utf8.aff
+sed -i "" -e '/^ICONV/d' -e 's/^SET UTF-8$/SET ISO8859-1/' en_US-mozilla.aff
+
+# Convert the dictionary to ISO-8859-1
+cp en_US-mozilla.dic utf8/en-US-utf8.dic
+iconv -f utf-8 -t iso-8859-1 < utf8/en-US-utf8.dic > en_US-mozilla.dic
+
+cp en_US-mozilla.aff ../en-US.aff
+cp en_US-mozilla.dic ../en-US.dic
+mv README_en_US-mozilla.txt ../README_en_US.txt
+
+echo "New dictionary copied into place. Please commit the changes."