Difference between revisions of "Translating Microsoft RESX Files in Wordfast Pro"

From Wordfast Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 28: Line 28:
  
 
Save the '''miscrosoft_resx.properties''' file and add it to Wordfast Pro as a rules file. You can either add it to a specific project if you are sure you will not need it in the future or make it available for all future projects. In the latter case, start Wordfast Pro and ''without opening any project'', repeat the steps below:
 
Save the '''miscrosoft_resx.properties''' file and add it to Wordfast Pro as a rules file. You can either add it to a specific project if you are sure you will not need it in the future or make it available for all future projects. In the latter case, start Wordfast Pro and ''without opening any project'', repeat the steps below:
* Click '''Preferences'''.
+
# Click '''Preferences'''.
* Under '''New Project Preferences''', click '''Filters'''.
+
# Under '''New Project Preferences''', click '''Filters'''.
* Click the '''Add''' button.
+
# Click the '''Add''' button.
* In the '''Choose file format''' drop-down, select ''Text-based filter (*.xml)''.
+
# In the '''Choose file format''' drop-down, select ''Text-based filter (*.xml)''.
* Type a name for the filter, e.g. ''Microsoft RESX'' in the '''Filter Name''' field.
+
# Type a name for the filter, e.g. ''Microsoft RESX'' in the '''Filter Name''' field.
* Select UTF-8 as '''Target Encoding'''.
+
# Select ''UTF-8'' as '''Target Encoding'''.
* Click '''Browse...''' to specify the location of the rules file you created above.
+
# Click '''Browse...''' to specify the location of the rules file you created above.
* Do not change the ''xml'' extension.
+
# Do not change the ''xml'' extension.
* Click '''OK'''.
+
# Click '''OK'''.
  
 
Now proceed to create a new project in which you want to translate ''.resx'' files (their extensions changed to ''xml'' as explained above). When you add a ''.resx'' file to your project, the '''Type''' column will show ''Microsoft RESX''. If it doesn't, you will need to select it in the drop-down list.
 
Now proceed to create a new project in which you want to translate ''.resx'' files (their extensions changed to ''xml'' as explained above). When you add a ''.resx'' file to your project, the '''Type''' column will show ''Microsoft RESX''. If it doesn't, you will need to select it in the drop-down list.
Line 47: Line 47:
  
 
When you complete your translation and save the translated file, you will need to change its extension back to ''.resx'' and remove the target language suffix that Wordfast Pro adds to the translated file.
 
When you complete your translation and save the translated file, you will need to change its extension back to ''.resx'' and remove the target language suffix that Wordfast Pro adds to the translated file.
 +
 +
==References==
 +
 +
[[Category:Wordfast Pro]]

Latest revision as of 10:25, 17 March 2022

Microsoft .resx files are not directly supported by Wordfast Pro.

A .resx file is, however, an XML file with a different extension, which means it is possible to translate it in Wordfast Pro by changing the file extension, e.g. from translatable-file.resx to translatable-file.resx.xml.

Since XML files often contain proprietary coding that specifies the human-readable (and translatable) text, it is necessary to create a special rules file to instruct Wordfast Pro how to separate the program code from the human text. In order to do this, we need to first take a look at the .resx file by opening it in a text editor such as Notepad++.

When we examine a .resx file, we discover that the human-readable text is wrapped in <value> ... </value> tags.

To create the rules file we need, create a new blank document in Notepad++ and save it as miscrosoft_resx.properties. Make sure you save this file in a secure location on your computer's drive, do not move it and do not rename it.

A Wordfast Pro rules file needs to contain the following instructions. Simply copy and paste them in your microsoft_resx.properties file.


paragraphPrefix.0=<value>

paragraphSuffix.0=</value>

paragraphFormat.0=html-included

internalTag.0=\\{.*?\\}


Explanation:

  • The paragraphPrefix instruction tells Wordfast Pro what precedes the translatable text, which is the opening <value> tag.
  • The paragraphSuffix instruction tells Wordfast Pro what succeeds the translatable text, which is the closing </value> tag.
  • The paragraphFormat instruction tells Wordfast Pro that the translatable text may contain HTML tags; if any, they will be converted to tags that we can easily transfer from the source to the target segment.
  • The internalTag instruction tells Wordfast Pro that the translatable text may contain placeholders that look like this: {0} or {1}. The regular expression used above actually tells Wordfast Pro to look for an opening curly brace, followed by any character, repeated one or more times, followed by a closing curly brace. If we are sure that only single-digit numbers are contained in the curly braces, we can modify this to \\{[0-9]}\\}.

Save the miscrosoft_resx.properties file and add it to Wordfast Pro as a rules file. You can either add it to a specific project if you are sure you will not need it in the future or make it available for all future projects. In the latter case, start Wordfast Pro and without opening any project, repeat the steps below:

  1. Click Preferences.
  2. Under New Project Preferences, click Filters.
  3. Click the Add button.
  4. In the Choose file format drop-down, select Text-based filter (*.xml).
  5. Type a name for the filter, e.g. Microsoft RESX in the Filter Name field.
  6. Select UTF-8 as Target Encoding.
  7. Click Browse... to specify the location of the rules file you created above.
  8. Do not change the xml extension.
  9. Click OK.

Now proceed to create a new project in which you want to translate .resx files (their extensions changed to xml as explained above). When you add a .resx file to your project, the Type column will show Microsoft RESX. If it doesn't, you will need to select it in the drop-down list.


Microsoft RESX filter.png


NB! .resx files can contain a lot of data even if their size appears small, e.g. 500 KB or 900 KB. Wordfast Pro might take a few minutes to read this data after you add the source file, so please be patient.

When you complete your translation and save the translated file, you will need to change its extension back to .resx and remove the target language suffix that Wordfast Pro adds to the translated file.

References