Overview
The Foreign Words plugin for Sigil automatically identifies and marks foreign words or phrases within EPUB files. It uses user-defined dictionaries to detect foreign expressions and applies customizable HTML markup (
<span> tags) to these expressions, facilitating consistent styling and language identification.
Main Features- Automatic Detection: Scans EPUB content for words or phrases defined in user dictionaries
OR
Search for existing: Searches the document for all <span> tags with the specified language in the lang or xml:lang attribute.
- Customizable Markup: Wraps detected expressions in <span> tags with optional CSS classes and language attributes.
- Phrase Combination: Optionally combines adjacent foreign words into phrases.
- Span Merging: Optionally merges adjacent <span> tags with identical attributes to optimize markup structure.
Configuration Options
The plugin provides a graphical interface allowing users to configure plugin options easily.
The interface dynamically updates a preview of the resulting
<span> markup based on current settings.
Users can customize the following settings:
Use Dictionary File
If the option is enabled, words/phrases are searched based on the user's dictionary, and if disabled, we look for existing <span> tags in the document according to the selected language through the drop-down list "Look For This Language Code"
User Dictionary File
Select the dictionary file containing foreign words (only filenames without extension)
Ignore CSS Class
You can ignore existing classes in <span> tags
Use CSS Class
Enable/disable adding a CSS class to marked expressions
CSS Class Name
Name of the CSS class applied to marked expressions
Use Lang Attribute
Enable/disable adding lang attribute
Use xml:lang Attribute
Enable/disable adding xml:lang attribute
Language Code
Language code used in attributes (lang and xml:lang)
Combine Words
Combine adjacent foreign words into phrases
Merge Spans
Merge adjacent <span> tags with identical attributes
Run Without Confirmation
Execute plugin without confirmation dialogs
Debug Mode
Enable detailed logging for troubleshooting. Useful information, but more for developers.
What exactly does the plugin do?- All detected foreign words/phrases are wrapped in <span> tags.
- Tags include optional CSS class (class="english" by default).
- Tags include language attributes (lang="en" and/or xml:lang="en").
- Adjacent marked words can be combined into single phrases.
- Adjacent spans can be merged if enabled.
Example output:
Code:
<span class="english" lang="en" xml:lang="en">foreign phrase</span>
Description updated: April 3, 2025
Applies to plugin version: 0.0.107 (beta6)