Search:   Help



LyX documentation


Shared groups



<< | Page list | >>

Python script to help translate a LyX/Latex document with Google Translate.

Table of contents (hide)

  1.   1.  How to translate
  2.   2.  Categories

1.  How to translate

I wrote this little script to do some basic translation from English to Spanish, but it should work with any translation combination that Google Translate supports.

When translating I often find it convenient to first translate automatically and then fix the result up by hand.

This script works this way:

First run it with the -i option (default). This will go through all lyx files in the folder, convert them to latex, and then to an html-code which can survive Google translate almost without destruction. You then chose "translate a file" on Google translate and upload the created html-files.

Next you copy the result into a new tex-file. Some files are split in two or more files. Sometimes Google translate still only translates a part of the files. simply hit "translate" again.

When you have saved all your files as tex-files (best in a new directory), you then run the script from that folder with the -f option. This fixes some issues with the output of Google translate, specifically spacing.

Next you open each of these files with Lyx like this:

lyx -i latex TEXFILE.tex

It should now come up within the translated files in Lyx.

The script can be improved a lot. Also, Google translate in two cases (of a 100,000 word book) decided to break of just before the end of a paragraph. I had to fix that by hand.

2.  Categories

Category: translate, conversion, scripts

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2011-09-07 12:55 UTC