Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 06-24-2016, 09:42 PM   #1
Hopkins
Junior Member
Hopkins began at the beginning.
 
Posts: 5
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 between both formats.

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
  • Provides command line processing for batch operations
  • This is an editor plugin so users can make changes in case the conversion is not perfect

Testing Platforms
  • Windows 10 (64 bit) - Calibre version 2.71
  • Linux Kubuntu 16.04 (64 bit) - Calibre 2.71
  • Amazon Paperwhite 3G

Note:
Command Line Interface(CLI)
Details:

Spoiler:
Unix Example: overwrite all epub files in a directory from Taiwan traditional into Mainland simplified:
calibre-debug --run-plugin "Chinese Text Conversion" -- -ol cn -il tw -d t2s my_chinese_epub_dir/*.epub
Windows example: update all epub files in a directory from Taiwan traditional into Mainland simplified but write them to a separate directory:
calibre-debug --run-plugin "Chinese Text Conversion" -- -ol cn -il tw -d t2s -of new_dir my_chinese_epub_dir\*.epub
Unix 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}] [-ol {cn,hk,tw}]
                         [-d {t2s,s2t,t2t}] [-p] [-v] [-t] [-q]
                         [-od OUTDIR_OPT] [-a APPEND_SUFFIX_OPT] [-f] [-s]
                         epub-filepath [epub-filepath ...]

Convert Chinese characters between traditional (t) and simplified (s) types.
Plugin Version: 2.0.0

positional arguments:
  epub-filepath         One or more EPUB filepaths - UNIX style wildcards
                        accepted

optional arguments:
  -h, --help            show this help message and exit
  -il {cn,hk,tw}, --input-locale {cn,hk,tw}
                        Set to the epub origin locale if known (Default: cn)
  -ol {cn,hk,tw}, --output-locale {cn,hk,tw}
                        Set to the epub target locale (Default: cn)
  -d {t2s,s2t,t2t}, --direction {t2s,s2t,t2t}
                        Set to the epub conversion direction (Default: t2s)
  -p, --phrase_convert  Convert phrases to target locale versions (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
                        overides the -s option (Default: False)
  -od OUTDIR_OPT, --output-dir OUTDIR_OPT
                        Set to the epub output file directory (Default:
                        overwrite existing epub 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 v1.46 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

Version History:
  • Version 1.0.0 - 24 Jun 2016. Initial release
  • Version 1.1.0 - 27 Jun 2016. Improved speed
  • Version 1.2.0 - 29 Jun 2016. Correct conversion, turn on compression for the plugin zip file
  • Version 2.0.0 - 10 Nov 2016. Added command line processing, now also update TOC and metadata, updated conversion dictionaries
Attached Thumbnails
Click image for larger version

Name:	captioned_menu.png
Views:	226
Size:	246.9 KB
ID:	149654  
Attached Files
File Type: zip TradSimpChinese_2_0_0.zip (441.4 KB, 1449 views)

Last edited by Hopkins; 11-10-2016 at 08:33 PM. Reason: Fix typo
Hopkins is offline   Reply With Quote
Old 06-24-2016, 10:43 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 29,671
Karma: 7528425
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Thanks, I have added it to the plugin index.
kovidgoyal is offline   Reply With Quote
 
Advertisement
Old 08-25-2016, 11:21 AM   #3
GameMonsters
Junior Member
GameMonsters doesn't litterGameMonsters doesn't litter
 
Posts: 8
Karma: 100
Join Date: Jun 2011
Device: Nook, Nook Color, ASUS, Galaxy
Wow. Thank you. I finally can check out simplified Chinese books from my library. I have been waiting for a useful tool like this. Thank you SO MUCH.
GameMonsters is offline   Reply With Quote
Old 10-19-2016, 12:56 AM   #4
howardtang
Junior Member
howardtang began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2016
Device: Kindle PaperWhite
This plugin is really useful, and I use it all the time. However, I have two little recommendations for you.

1) this plugin can't convert the Chinese words inside metadata and table of contents
2) it would be perfect if there is a bulk convert function

i look forward to the next update~
howardtang is offline   Reply With Quote
Old 10-21-2016, 11:54 PM   #5
Hopkins
Junior Member
Hopkins began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2016
Location: Minnesota USA
Device: Amazon Paperwhite 3G
Those changes look like they would be very useful. I have spare time, so I think I can take a quick cut at it next week.
Hopkins is offline   Reply With Quote
Old 11-10-2016, 08:34 PM   #6
Hopkins
Junior Member
Hopkins began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2016
Location: Minnesota USA
Device: Amazon Paperwhite 3G
Update to 2.0.0

Plugin updated:

- Added command line processing to support batch processing
- Updated dictionary (txt) files based on OpenCC changes:- Plugin now updates Table of Contents (TOC) and Content metadata. The GUI updates both only if the "Entire eBook" option selected. Command line always does the entire book.
Hopkins is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
traditional and simplified chinese character set? mzmm ePub 3 05-10-2013 08:41 AM
Best ereader with (simplified) Chinese support in Australia fallsauce Which one should I buy? 3 12-29-2011 08:59 PM
A Simplified Chinese + English font that actually looks good macroexp Sony Reader Dev Corner 5 12-25-2010 12:08 AM
iLiad Enable Simplified Chinese handwriting ericshliao iRex Developer's Corner 2 04-15-2010 02:58 AM
Looking for Contemporary Simplified Chinese Books for PRS 505 eldon Sony Reader 2 08-25-2008 06:22 AM


All times are GMT -4. The time now is 05:34 AM.


MobileRead.com is a privately owned, operated and funded community.