Difference between revisions of "Translating Excel Files with Wordfast Pro"

From Wordfast Wiki
Jump to: navigation, search
(Potential Problems)
 
(5 intermediate revisions by 3 users not shown)
Line 24: Line 24:
 
This is definitely the most complex way of specifying content to be extracted for translation. In time, the import wizard will be implemented which can be used instead of this method.
 
This is definitely the most complex way of specifying content to be extracted for translation. In time, the import wizard will be implemented which can be used instead of this method.
 
To use an XML configuration file:
 
To use an XML configuration file:
# Download a template XML file [https://drive.google.com/open?id=0B_JjtVOA_tb5MWpuTzZtbEhHYlE here].
+
# Download a template XML file [https://www.wordfast.com/sites/default/files/excelConfig.xml here].
 
# Open the Excel file to be translated to identify what needs to be translated. Keep this open while configuring the XML file.
 
# Open the Excel file to be translated to identify what needs to be translated. Keep this open while configuring the XML file.
 
# Open the excelConfig.xml template file using a text editor. We recommend the free [http://www.barebones.com/products/textwrangler/download.html TextWrangler] for Mac or [https://notepad-plus-plus.org/download/v6.9.2.html Notepad++] for PC. [[File:XML_configuration.jpg|600 px|Excel XML Configuration file]]
 
# Open the excelConfig.xml template file using a text editor. We recommend the free [http://www.barebones.com/products/textwrangler/download.html TextWrangler] for Mac or [https://notepad-plus-plus.org/download/v6.9.2.html Notepad++] for PC. [[File:XML_configuration.jpg|600 px|Excel XML Configuration file]]
 
# The first section (under <span style="color:#967AB2;"><nowiki><!-- Configuration for Excel filter (ConvertXLS) --></nowiki></span>, row 4), contains default settings that are familiar from the Excel filter options in the Wordfast Pro ''Preferences''. You can change ''true'' to ''false'' or ''false'' to ''true'' depending on what you want.  
 
# The first section (under <span style="color:#967AB2;"><nowiki><!-- Configuration for Excel filter (ConvertXLS) --></nowiki></span>, row 4), contains default settings that are familiar from the Excel filter options in the Wordfast Pro ''Preferences''. You can change ''true'' to ''false'' or ''false'' to ''true'' depending on what you want.  
 
## If your Excel file contains HTML tags such as <nowiki><b> for bold, <i> for italics,</nowiki> etc., you should convert said HTML tags into Wordfast tags.<ref>This usually happens when web content has been extracted from a website into an Excel file and the translation will be re-imported later from the Excel file.</ref> Otherwise, they will be extracted as translatable text and will be a pain to replicate in Wordfast. Moreover, they will pollute your TM with non-sensical codes.
 
## If your Excel file contains HTML tags such as <nowiki><b> for bold, <i> for italics,</nowiki> etc., you should convert said HTML tags into Wordfast tags.<ref>This usually happens when web content has been extracted from a website into an Excel file and the translation will be re-imported later from the Excel file.</ref> Otherwise, they will be extracted as translatable text and will be a pain to replicate in Wordfast. Moreover, they will pollute your TM with non-sensical codes.
## Copy and paste the following regular expression between the <span style="color:#384FF4;"><nowiki><regexp></nowiki></span> and <span style="color:#384FF4;"><nowiki></regexp></nowiki></span> tags to convert embedded HTML tags and entities into Wordfast tags: <nowiki>(&amp;[^&amp; ;]+?;)|(&lt;[^&lt;&gt;]+?&gt;)</nowiki>
+
## Copy and paste the following regular expression between the <span style="color:#384FF4;"><nowiki><regexp></nowiki></span> and <span style="color:#384FF4;"><nowiki></regexp></nowiki></span> tags to convert embedded HTML tags and entities into Wordfast tags: <nowiki>&amp;lt;[^&amp;gt;]*&amp;gt;</nowiki>
 
# The next section (under <span style="color:#967AB2;"><nowiki><!-- worksheet configuration can be placed here --></nowiki></span>, row 17), is used to specify for each or every sheet:
 
# The next section (under <span style="color:#967AB2;"><nowiki><!-- worksheet configuration can be placed here --></nowiki></span>, row 17), is used to specify for each or every sheet:
 
## What row the translation should start and end on
 
## What row the translation should start and end on
Line 40: Line 40:
 
## Click on the '''''Add''''' button.
 
## Click on the '''''Add''''' button.
 
## Choose the format of the Excel file you need to translate (XLS or XLSX).
 
## Choose the format of the Excel file you need to translate (XLS or XLSX).
## Name your filter something that is easily recognizable and that you can remember.
+
## Name your filter something that is easily recognizable and that you can remember, e.g. ''Bilingual Excel A into B'', where ''bilingual'' indicates that both the source and target languages will be present in the translated file, and ''A into B'' indicates that the source text is in column A and the target is in column B.
 
## Tick all boxes that correspond to ''true'' using in the XML configuration file<ref>Author's note: '''DOUBLE CHECK''' with developers whether this is necessary or if the XML configuration overrides all options by default.</ref>
 
## Tick all boxes that correspond to ''true'' using in the XML configuration file<ref>Author's note: '''DOUBLE CHECK''' with developers whether this is necessary or if the XML configuration overrides all options by default.</ref>
 
## Browse to load your XML Configuration file.
 
## Browse to load your XML Configuration file.
Line 51: Line 51:
 
'''Note''': Any text between <span style="color:#967AB2;"><nowiki><!--</nowiki></span> and <span style="color:#967AB2;"><nowiki>--></nowiki></span> is only there to help you. You can leave it in the file or you can delete it; this will not affect how the Excel content is extracted.
 
'''Note''': Any text between <span style="color:#967AB2;"><nowiki><!--</nowiki></span> and <span style="color:#967AB2;"><nowiki>--></nowiki></span> is only there to help you. You can leave it in the file or you can delete it; this will not affect how the Excel content is extracted.
  
Click to download a [https://drive.google.com/open?id=0B_JjtVOA_tb5RVVOMFcwS0RJMm8 sample Excel file] and its corresponding [https://drive.google.com/open?id=0B_JjtVOA_tb5LXJockx6MWpiRHM XML configuration file].
+
Click to download a [https://www.wordfast.com/sites/default/files/ExcelConfigSampleFile.xls sample Excel file] and its corresponding [https://www.wordfast.com/sites/default/files/excelConfig.xml XML configuration file].
  
 
== Forbidden Characters ==
 
== Forbidden Characters ==
Line 58: Line 58:
  
 
  : \ / ? * [ ]
 
  : \ / ? * [ ]
 +
 +
== Potential Problems ==
 +
 +
Wordfast Pro will also fail to save the translated Excel file if the translation contains duplicate sheet names, i.e. the same translation was made for two or more sheet names. A general error message will be shown in this case: "An error occurred while saving the document. More details: An unexpected error occurred during align of the file. java.lang.RuntimeException: There was a problem aligning excel document."
 +
 +
If the sheet name exceeds 31 characters, a red flashing border will appear around the segment length field in the status bar. When saving the translated file, the sheet name will automatically be cut off to 31 characters.
  
 
==References==
 
==References==

Latest revision as of 19:07, 21 November 2022

Wordfast Pro has not yet implemented an Excel import wizard. Until this is done, you have three options when importing Excel files for translation.

Extract all Content for Translation

This is the default setting of the Excel filter. Simply add an Excel file to a project and all of its content will be extracted for translation.

Modify the Excel Filter or the File to Specify Content for Translation

Before importing your Excel file, you can modify the default Excel filter (XLS and/or XLSX) in the Wordfast Pro Preferences > Project Preferences > Filters to specify the content that needs to be extracted for translation. You may also want to pre-process the Excel file before importing. For example, you might be asked not to translate certain sheets but your client has not hidden them for you. Here is a list of extraction options that can be selected or deselected:

  • Extract sheet names
  • Skip cells with formulas
  • Skip hidden rows or columns
  • Treat numbers stored in text format as real numbers, which means they won't be extracted since numbers are non-translatable.
  • Translate data validation comments
  • Translate hidden sheets
  • Translate cell comments
  • Translate dropdown lists
  • Extract cells in column order (segment ordering would be A1, A2, A3, B1, B2, B3 as opposed to A1, B1, A2, B2, A3, B3)
  • Extract soft return strategy (set by default to be interpreted as a tag)

Use an XML configuration file

This is definitely the most complex way of specifying content to be extracted for translation. In time, the import wizard will be implemented which can be used instead of this method. To use an XML configuration file:

  1. Download a template XML file here.
  2. Open the Excel file to be translated to identify what needs to be translated. Keep this open while configuring the XML file.
  3. Open the excelConfig.xml template file using a text editor. We recommend the free TextWrangler for Mac or Notepad++ for PC. Excel XML Configuration file
  4. The first section (under <!-- Configuration for Excel filter (ConvertXLS) -->, row 4), contains default settings that are familiar from the Excel filter options in the Wordfast Pro Preferences. You can change true to false or false to true depending on what you want.
    1. If your Excel file contains HTML tags such as <b> for bold, <i> for italics, etc., you should convert said HTML tags into Wordfast tags.[1] Otherwise, they will be extracted as translatable text and will be a pain to replicate in Wordfast. Moreover, they will pollute your TM with non-sensical codes.
    2. Copy and paste the following regular expression between the <regexp> and </regexp> tags to convert embedded HTML tags and entities into Wordfast tags: &lt;[^&gt;]*&gt;
  5. The next section (under <!-- worksheet configuration can be placed here -->, row 17), is used to specify for each or every sheet:
    1. What row the translation should start and end on
    2. Which columns should be translated and if the translation should be placed in the same or another column
    3. If the number of characters per cell in a column should be restricted
  6. If different sheets in the workbook require different configurations, copy the entire section between the <sheet> and </sheet> tags (rows 19 and 48 in the image above) and paste it as many times as necessary under the </sheet> tag.
  7. Save your XML Configuration file once finished and use it to create a new XLS or XLSX filter in Wordfast Pro:
    1. At the Project List view, click on Preferences (or press F9).
    2. Under the "New Project Preferences" section, click on Filters.
    3. Click on the Add button.
    4. Choose the format of the Excel file you need to translate (XLS or XLSX).
    5. Name your filter something that is easily recognizable and that you can remember, e.g. Bilingual Excel A into B, where bilingual indicates that both the source and target languages will be present in the translated file, and A into B indicates that the source text is in column A and the target is in column B.
    6. Tick all boxes that correspond to true using in the XML configuration file[2]
    7. Browse to load your XML Configuration file.
    8. Click on OK.
    9. Click on OK to close the "Preferences" window and save your settings.[3]
  8. Create a project.
  9. After adding your Excel file, select the appropriate filter under the Type column (unless you have specified your XML configured filter as default).
  10. Complete the project creation wizard to create a bilingual file and begin translation.

Note: Any text between <!-- and --> is only there to help you. You can leave it in the file or you can delete it; this will not affect how the Excel content is extracted.

Click to download a sample Excel file and its corresponding XML configuration file.

Forbidden Characters

Wordfast Pro is unable to save a translated Excel document when the following forbidden characters are used in worksheet names:

: \ / ? * [ ]

Potential Problems

Wordfast Pro will also fail to save the translated Excel file if the translation contains duplicate sheet names, i.e. the same translation was made for two or more sheet names. A general error message will be shown in this case: "An error occurred while saving the document. More details: An unexpected error occurred during align of the file. java.lang.RuntimeException: There was a problem aligning excel document."

If the sheet name exceeds 31 characters, a red flashing border will appear around the segment length field in the status bar. When saving the translated file, the sheet name will automatically be cut off to 31 characters.

References

  1. This usually happens when web content has been extracted from a website into an Excel file and the translation will be re-imported later from the Excel file.
  2. Author's note: DOUBLE CHECK with developers whether this is necessary or if the XML configuration overrides all options by default.
  3. If you regularly need to use this newly created filter, you can set it as default before closing the "Preferences" window.