Enthusiast
Posts: 38
Karma: 10
Join Date: Jun 2016
Location: Minnesota USA
Device: Amazon Paperwhite 3G
|
[Editor Plugin] Traditional<->Simplified Chinese Convertor
Currently, the Chinese language is written with two different standardized character sets. The Chinese mainland and Singapore officially use the simplified set while other areas (such as Taiwan and Hong Kong) continue to largely use the traditional set. This plugin will allow users to convert EPUB and AZW3 files between both formats.
If only text format changes are desired (such as flow direction or quotation mark types), character set changes can be omitted. This allows changes to non-Chinese texts such as Japanese.
Main Features- Convert eBooks written in traditional characters into simplified characters
- Convert eBooks written in simplified characters into traditional characters
- Convert regional words and idioms used in the source material to those words and idioms used in the destination material
- Convert individual sections or the entire book
- Update metadata and table of contents
- Convert text direction to vertical or horizontal
- Provides command line processing for batch operations
- This is an editor plugin so users can make changes in case the conversion is not perfect. Conversions from simplified to traditional should always be proofread.
Testing Platforms- Windows 10 (64 bit) - Calibre version 6.10
Note:
Github repository link
Command Line Interface(CLI)
Details:
Spoiler:
Example: overwrite all ebook files in a directory from Mainland simplified into Taiwan traditional (also change to East Asian quote marks and vertical text orientation) add in a "V" suffix to the file name and optimizing for display on the Chrome Readium reader: calibre-debug --run-plugin "Chinese Text Conversion" -- -ol tw -il cn -d s2t -od out -qt e -td v -up -a V *.epub *.azw3
Example: overwrite all epub files in a directory from Taiwan traditional into Mainland simplified, but don't actually perform the write. Just print what would happen: calibre-debug --run-plugin "Chinese Text Conversion" -- -ol cn -il tw -d t2s -t my_chinese_epub_dir/*.epub
Code:
usage: calibre-debug.exe [-h] [-il {cn,hk,tw,jp}] [-ol {cn,hk,tw,jp}] [-d {t2s,s2t,t2t,none}] [-p]
[-qt {w,e,no_change}] [-td {h,v,no_change}] [-up] [-v] [-t] [-q] [-od OUTDIR_OPT]
[-a APPEND_SUFFIX_OPT] [-f] [-s]
ebook-filepath [ebook-filepath ...]
Convert Chinese characters between traditional/simplified types and/or change text style. Generally run as: calibre-
debug --run-plugin "Chinese Text Conversion" -- [options] ebook-filepath Plugin Version: 3.0.0
positional arguments:
ebook-filepath One or more epub and/or azw3 ebook filepaths - UNIX style wildcards accepted
options:
-h, --help show this help message and exit
-il {cn,hk,tw,jp}, --input-locale {cn,hk,tw,jp}
Set to the ebook origin locale if known (Default: cn)
-ol {cn,hk,tw,jp}, --output-locale {cn,hk,tw,jp}
Set to the ebook target locale (Default: cn)
-d {t2s,s2t,t2t,none}, --direction {t2s,s2t,t2t,none}
Set to the ebook conversion direction (Default: none)
-p, --phrase_convert Convert phrases to target locale versions (Default: False)
-qt {w,e,no_change}, --quotation-type {w,e,no_change}
Set to Western or East Asian (Default: no_change)
-td {h,v,no_change}, --text-direction {h,v,no_change}
Set to the ebook origin locale if known (Default: no_change)
-up, --update_punctuation
Update punctuation to match direction change (Default: False)
-v, --verbose Print out details as the conversion progresses (Default: False)
-t, --test Run conversion operations without saving results (Default: False)
-q, --quiet Do not print anything, ignore warnings - this option overrides the -s option (Default: False)
-od OUTDIR_OPT, --output-dir OUTDIR_OPT
Set to the ebook output file directory (Default: overwrite existing ebook file)
-a APPEND_SUFFIX_OPT, --append_suffix APPEND_SUFFIX_OPT
Append a suffix to the output file basename (Default: )
-f, --force Force processing by ignoring warnings (e.g. allow overwriting files with no prompt)
-s, --show Show the settings based on user cmdline options and exit (Default: False)
Installation Steps:Download the attached zip file and install the plugin/add to context menu or toolbar/restart Calibre as described in the Introduction to plugins .
Operation:From the main Calibre window, select a book and then press the "Edit book" icon on the toolbar. The editor will open. Press the "plugins" text on the editor toolbar and select the plugin.
Special Notes:- Requires calibre v6.0 or higher
- No testing has been done on OS X systems
- Keep a copy of the original file. Round trip conversions (i.e. traditional->simplified->traditional) will probably not recover the original version. Also, since characters are being replaced, it's possible the font in your eBook reader may not have all the necessary glyphs
- Metadata changes made via the GUI do not update the main Calibre database. They will be overwritten once the editor is re-opened. Consider using the 'Save a copy' option
- Calibre Version 5.0 and later support the reading of vertical text. Earlier versions did not.
Version History:
Last edited by Hopkins; 03-27-2023 at 12:59 PM.
Reason: Fix Version: 3.0.1
|