Updated: April 3, 2025
Current Version: "0.0.107"
Status: BETA5
Plugin type: edit
Plugin icon:
License/Copying: GNU LGPL Version 2 or Version 3 your choice. Any other license terms are only available directly from the author in writing.
Change Log:- v0.0.XX - Private alpha versions
- v0.0.57 - First public beta version
- v0.0.82 - Public beta 2 version
- v0.0.83 - Public beta 3 version
- v0.0.94 - Public beta 4 version
- v0.0.106 - Public beta 5 version
- v0.0.107 - Public beta 6 version
Warning:
Since the plugin is in beta and could potentially work in unpredictable ways, be sure to back up EPUB files and/or use checkpoints.
Introduction:
The first versions of the plugin were created in 2020, but the work was abandoned. I returned to the idea in 2024 and used the working version privately. In 2025, I finally decided to register on MR and present the plugin to the world.
How it works:
The plugin is Sigil-centric, so it uses user dictionaries (file names without extensions). The dictionaries are cleverly created by Sigil, so I don't have to worry about duplicates, for example.
Based on the words in the user dictionary, the plugin searches the selected (or all) xhtml files and looks for words in the text.
Once a word is found, the plugin doesn't rest on its laurels, but checks for earlier and later words in the dictionary. This way, the plugin finds whole phrases. Once all the words and phrases are determined, the main action begins.
The found words/phrases are surrounded by the SPAN tag along with the selected
class,
lang and
xml:lang attributes. Each attribute is treated individually, so you can select all or none. In the latter case, the "naked" SPAN will be applied.
If the word/phrase has already been surrounded by a SPAN tag then [NOTE! THIS IS IMPORTANT!] the existing attributes will be updated or removed – according to the current plugin configuration.
The plugin can also work without a dictionary and then it searches in the text for all existing span tags with the declared language in the "lang" or "xml:lang" attribute. We can substitute language attributes in such spans and add or remove a class.
Work on one, several or all xhtml files.
Spoiler:
If you select only one file (or a few) in the Book Browser window

then the plugin will operate only on that file:
If you select the virtual folder "Text" in the Book Browser window

the plugin will operate on all xhtml files:
The configuration window icon also determines the status of the plugin.
Beta version:
Stable version:
Languages:
The user can freely edit the list of languages that will be available in the drop-down list.
If the main text is in English (or any other language derived from Latin), but contains inserts in Russian, Georgian, Hebrew, Arabic, Korean, Chinese, or Japanese it is relatively easy to detect them in the SpellCheck window and add them to the corresponding user dictionary.
anguages that have identical words are sometimes problematic, because they can be attributed to a foreign language, although they also occur in the main language of the book.
UI translation:
The plugin is prepared to translate the interface, but I think that possible willing translators can do it when the stable version is published.
Credits/Thanks:
Installation:
1. Select Manage Plugins from the Plugins menu. In the Manage Plugins dialog box, select
Use Bundled Python, if it isn't already selected. (If your Sigil version doesn't have a
Use Bundled Python option, click one of the Auto buttons to detect the path or Set to manually select the Python interpreter path.)
2. Click Add Plugin and select
ForeignWords_v0.X.Y.zip. This will install the ForeignWords plugin, which you can select via Plugins > Edit > ForeignWords.
Issues:
Please note that the plugin
MAY have a destructive effect on existing SPAN tags that contain
class,
lang and
xml:lang attributes. While the plugin is running, if only a matching word is found then the existing attributes are replaced (or removed!) according to the configuration.
If existing attributes in SPAN tags are also sorted alphabetically, making it easy to merge them into longer phrases covered by the same tags with identical attributes.
If you want to keep the existing "class" attribute, enable the "Ignore CSS Class" option.
OS Requirements:
Windows/Linux/OS X.
I tested this plugin on Windows 10 and Windows 11 with Sigil 2.3.0, 2.4.0, 2.4.2, pre-2.5.0, but it should work the same on Linux and macOS.
*** Linux users will have to make sure that the PyQt5 graphical Python module (or PySide6 module starting with Sigil 2.0) is present if it's not already. ***
Please feel free to give me feedback.
Sigil Requirements:
I have set the minimum version of Sigil at 1.0.0, but I still need to check it more carefully.
Here I ask for feedback on whether the plugin works properly in Sigil version 1.X.
Links to related posts/threads: