Welcome / Bienvenue / Benvinguts / Bienvenidos
For information about my translation services, please visit the main site.
Pour des informations sur mes services, merci de regarder le site principal.
Para información sobre mis servicios de traducción, visite el web principal.

Macro to prepare documents for monolingual review in memoQ (and possibly other CAT tools)

MemoQ’s monolingual review feature works best with clean Word documents containing no tracked changes or comments. If you import a document in which changes are still visible or in which there are comments, memoQ will add lots of code to the target text, which you don’t want.

This macro cleans the document up and saves it under a new filename (so that you don’t overwrite the commented version), making it ready to be imported as a monolingual review.

The macro includes comments to explain what some of the lines are doing and how you can adjust the macro to meet your needs.

Since many translators use only straight apostrophes and quotation marks in memoQ, then convert them to the curly variety in the final document sent to the client, the macro includes an optional line (deactivated by default) that will revert all apostrophes and quotation marks to the straight variety. Please read the instructions carefully if you wish to use that line.

Thanks to Kevin Mote, who provided the code for the part of the macro that renames the file. My code is a slightly modified version of his. In particular, unlike Kevin’s version, mine does not overwrite the old version, since most translators would want to keep a copy of the commented version they sent to their client.


Sub PrepareForMemoQMonolingualReview()
' memoQ's monolingual review feature works best when you import a document with no tracked changes and no comments.
' This macro removes them, then resaves the file with "clean-for-import" appended to the file name.
' The part that appends the filename is adapted from the macro provided by Kevin Mote (https://www.linkedin.com/in/kevinmote/) at https://superuser.com/a/781501. Thank you Kevin. This was very helpful!
' Please note that, unlike Kevin's macro, this version does not delete the original file.
Dim strFileFullName, strFileName, strNewName, strFileExtension As String
'
ActiveDocument.AcceptAllRevisions ' Accepts all tracked changes
ActiveDocument.TrackRevisions = False ' Switches off track changes
ActiveDocument.DeleteAllComments ' Deletes all comments in the active document.

ReplaceQuotes ' Reverts quotation marks and apostrophes back to the straight variety, assuming that this is the variety that was used while working in the CAT tool.
' Remove the apostrophe from the above line if you want the monolingual review document to revert to straight apostrophes and quotation marks.
' Note that to run the above line you also need to have installed the "ReplaceQuotes" and "QuotesReplacementBothWays" macros, which I provided along with several others in a blog post at http://www.anglopremier.com/blog/?p=1119.
' *****ADDITIONAL OPTION DESCRIBED ABOVE*****

' Get current name:
strFileFullName = ActiveDocument.FullName 'for Word docs
'strFileFullName = ActiveWorkbook.FullName 'Use this line instead for for Excel docs
'strFileFullName = Application.ActivePresentation.FullName 'Use this line instead for Powerpoint presentations
If (InStr(strFileFullName, ".") = 0) Then ' Checks whether the full file name contains a file extension by looking for a dot.
res = MsgBox("File has not been saved. Can't rename it.", , "Rename File")
Exit Sub
End If
' strFileName = Right(strFileFullName, Len(strFileFullName) - InStrRev(strFileFullName, "\")) 'strip path - not used. Next line used instead.
strFileName = strFileFullName
strFileExtension = Right(strFileName, Len(strFileName) - InStrRev(strFileName, ".")) ' Identifies the file extension
strFileName = Left(strFileName, (InStr(strFileName, ".") - 1)) ' Strips the extension from the strFileName variable
' If InStr(3, strFileName, "_Delivery", 1) <> 0 Then strFileName = Left(strFileName, (InStr(strFileName, "_Delivery", 1) - 1))
' The above line is not used. Originally intended to strip the word "_Delivery" and the delivery number from the file name (assumes "Delivery" is at least the third character; not case-sensitive). But I dedcided I wanted to keep the delivery number.
' If you wish to remove something from the file name you can reinstate the above line (remove the apostrophe) and replace "_Delivery" with whatever you want to remove.

' Prompt for new name. Replace "_clean-for-import" on the next line if you prefer something else to be appended by default.
strNewName = InputBox("Rename this file to:", "Rename File", strFileName & "_clean-for-import." & strFileExtension) 'Saves with the new name. Extension is not changed.
If (strNewName = "") Or (strNewName = strFileName) Then ' (Check whether user cancelled)
Exit Sub
End If

' Save file with new name:
ActiveDocument.SaveAs2 FileName:=strNewName 'for Word docs
'ActiveWorkbook.SaveAs2 FileName:=strNewName 'for Excel docs
'Application.ActivePresentation.SaveAs FileName:=strNewName 'for Powerpoint presentations

End Sub

Share:

Macros to replace apostrophes and quotation marks before and after using a CAT tool

To ensure that concordance searches in translation memories work properly and to increase fuzzy matches, many translators systematically replace curly apostrophes and quotation marks with straight ones before importing a document into their CAT tool, then revert them back to the curly variety before delivering the final document to the client.

Until recently, I used a very simple find/replace macro to achieve this, but then I realized that the macro didn’t replace apostrophes and quotation marks situated. I searched online and found a solution that works not only in the main document but also in footnotes and text boxes. Thanks to Doug Robbins and Greg Maxey, whose work I drew on to create one of the macros below.

Copy the following code into a single module in your normal.dotm template, then run the ReplaceQuotes macro before importing your document into your CAT tool and the ReinstateQuotes macro after you have exported from your CAT tool to Word.

I’ve included extensive comments so that you can understand what each line is doing and adapt it as necessary.

Sub ReplaceQuotes() ‘ Replace curly quotation marks and apostrophes with straight ones.
Options.AutoFormatAsYouTypeReplaceQuotes = False ‘ Sets autoformat option not to replace curly quotes with straight ones. This is reset in the final like of the QuotesReplacementBothWays macro.
QuotesReplacementBothWays
End Sub

Sub ReinstateQuotes() ‘ Replace straight quotation marks and apostrophes with curly ones.
Options.AutoFormatAsYouTypeReplaceQuotes = True ‘ Sets autoformat option to replace curly quotes with straight ones, in case the user has manually set the option to false before running the macro.
QuotesReplacementBothWays
End Sub

Sub QuotesReplacementBothWays()
pFindTxtFromOtherMacro = “‘”
pReplaceTxtFromOtherMacro = “‘”
FindReplaceAnywhere
pFindTxtFromOtherMacro = “””” ‘ Find all quotation marks (smart or curly). Four quotation marks are needed because the ” symbol has a special meaning that must be cancelled.
pReplaceTxtFromOtherMacro = “””” ‘ Replaces with smart or curly, depending on whether ReplaceQuotes or ReinstateQuotes was run.
FindReplaceAnywhere

‘ Remove the apostrophes from the start of each line in this section to replace French guillemets with English-style straight quotation marks.
‘ pFindTxtFromOtherMacro = “« ” ‘ Find all opening guillemets followed by a space (incl. non-breaking spaces).
‘ FindReplaceAnywhere
‘ pFindTxtFromOtherMacro = “«” ‘ Find remaining opening guillemets with no space after.
‘ FindReplaceAnywhere
‘ pFindTxtFromOtherMacro = ” »” ‘ Find all closing guillemets preceded by a space (incl. non-breaking spaces).
‘ FindReplaceAnywhere
‘ pFindTxtFromOtherMacro = “»” ‘ Find remaining closing guillemets with no space before.
‘ FindReplaceAnywhere

pFindTxtFromOtherMacro = “” ‘ Makes the variable empty again
pReplaceTxtFromOtherMacro = “” ‘ Makes the variable empty again
Options.AutoFormatAsYouTypeReplaceQuotes = True ‘ Reverts to Word’s default setting. Change this to “False” if you prefer Word not to replace straight quotes with curly ones as you type.
End Sub

Public Sub FindReplaceAnywhere()
‘Performs a find/replace on all parts of a text, including footnotes, text boxes, etc.
‘Found on various webpages, but seems to have been originally created by Doug Robbins and Greg Maxey (https://wordmvp.com/FAQs/Customization/ReplaceAnywhere.htm).
‘Adapted so that it can be run with the find and replace strings pre-defined by other macros.

Dim rngStory As Word.Range
Dim pFindTxt As String
Dim pReplaceTxt As String
Dim lngJunk As Long
Dim oShp As Shape

If pFindTxtFromOtherMacro = “” Then
‘ This macro can be used on its own, in which case the user is asked what Word should find.
pFindTxt = InputBox(“Enter the text that you want to find.” _
, “FIND”)

If pFindTxt = “” Then
MsgBox “Cancelled by User”
Exit Sub
End If

Else
pFindTxt = pFindTxtFromOtherMacro
End If

TryAgain:
If pReplaceTxtFromOtherMacro = “” Then
‘ This macro can be used on its own, in which case the user is asked what Word should replace the found string with.
pReplaceTxt = InputBox(“Enter the replacement.”, “REPLACE”)

If pReplaceTxt = “” Then
If MsgBox(“Do you just want to delete the found text?”, _
vbYesNoCancel) = vbNo Then
GoTo TryAgain
ElseIf vbCancel Then
MsgBox “Cancelled by User.”
Exit Sub
End If
End If

Else
pReplaceTxt = pReplaceTxtFromOtherMacro
End If

lngJunk = ActiveDocument.Sections(1).Headers(1).Range.StoryType ‘Fix the skipped blank Header/Footer problem

For Each rngStory In ActiveDocument.StoryRanges ‘Iterate through all story types in the current document

Do
SearchAndReplaceInStory rngStory, pFindTxt, pReplaceTxt
On Error Resume Next

Select Case rngStory.StoryType

Case 6, 7, 8, 9, 10, 11
If rngStory.ShapeRange.Count > 0 Then
For Each oShp In rngStory.ShapeRange
If oShp.TextFrame.HasText Then
SearchAndReplaceInStory oShp.TextFrame.TextRange, _
pFindTxt, pReplaceTxt
End If
Next
End If
Case Else

End Select

On Error GoTo 0

Set rngStory = rngStory.NextStoryRange ‘Get next linked story (if any)

Loop Until rngStory Is Nothing ‘ Loops back to the “Do”

Next ‘ Loops back to “For Each rngStory”

End Sub

Public Sub SearchAndReplaceInStory(ByVal rngStory As Word.Range, _
ByVal strSearch As String, ByVal strReplace As String)

With rngStory.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = strSearch
.Replacement.Text = strReplace
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With

End Sub

Share:

For your critical documents, don’t trust a translator!

Hear me out… You’ve spent days or weeks working with a team to fine-tune your document before it is published. Now, it’s time to get it translated, so all you need is a good translator, right?

Wrong. If you needed a team to put together the original version, what makes you think a translator working alone will produce what you need? For your most critical documents, don’t trust a translator, trust a translation team. If you hire a translator who will work with another colleague, you’re more likely to receive a translation that has the same impact as the text you produced.

My workflow varies from project to project. For instance, for a recent document that had lots of short, catchy titles, I had a brainstorming session on the phone with my colleague, but I wouldn’t do that for every project. Here’s a typical workflow I might use when working with a colleague on an important document:

Step 1 – My first version: The fact my work will be read by an accomplished colleague shouldn’t make any difference. But I’ll be honest with you: it does. My reputation is important to me, and I know my colleague will pick up on anything that doesn’t quite sound right, or worse, any blatant mistranslations. So I read my work a little more carefully before passing it on. For some parts of the text, I even offer two solutions and leave a note asking my colleague which one he or she prefers.

Step 2 – My colleague’s edits: My colleague reads my work through carefully, edits it to improve the text, and adds additional comments with other ideas.

Step 3 – I go through all my colleague’s changes. Some of them I accept; some I reject; some I replace with a better idea.

Step 4 – My colleague looks at my feedback, and makes additional suggestions.

Step 5 – Depending on how much discussion is still taking place, I’ll either finalise the text or get on the phone and discuss the last few points.

Step 6 – I read through the entire text one last time in English to check the overall flow of the text before sending it to the client.

If it took an entire team to draft your document, or you had five different versions before you produced the definitive one, don’t have it translated by a translator working alone. Find a team.

Share:

La facturation en monnaie étrangère : un formulaire pour convertir les prix en euros selon la loi française

La loi française permet la facturation en monnaie étrangère, et le portail de l’Économie, des Finances, de l’Action et des Comptes publics explique comment le faire.

Pour le calcul du montant en euros de vos factures, j’ai créé un formulaire Excel. Il suffit d’introduire la date de facture, le montant et la devise pour que le formulaire vous calcule le montant en euros selon les deux méthodes permis par la loi française. Les taux de changes utilisés pour les conversions sont les taux officiaux de la Banque centrale européenne, qui publie les taux de référence utilisés par les autorités françaises.

ConversionFacturesDevises par anglopremier.com.

Share:

How to remove an initial cap from glossary entries

Many online glossaries start every term with a capital letter, such as in this example:

  • Comptes d’accumulation
  • Accumulation accounts

Since these terms would only be capped at the start of a sentence, translators ought to import them without the initial caps.

Use the following formula in Excel to remove leading caps. The formula below assumes the first term is in cell E1, but to change it to wherever your first term is, then paste it down all the rows containing terms.

=IF(EXACT(UPPER(MID(E1,2,1)),MID(E1,2,1))=TRUE,E1,LOWER(LEFT(E1,1))&RIGHT(E1,LEN(E1)-1))

Please note that if you don’t use Excel in English, you will need to translate the formula words. Also, if you have your system set to use decimal commas, replace the commas in the formula with semi-colons.

The reason the formula is so long is because it initially checks to see whether the second character is capped. If the second character is also capped, it assumes the term is an acronym, and therefore does not change the first character to lower case.

Share:

Configuration de l’orthographe traditionnelle dans Word

Word vous souligne le mot “oignon”, ou il ne vous signale pas que vous avez oublié l’accent circonflexe sur le mot “parait”? C’est parce que par défaut Word utilise l’orthographe réformée de 1990.

Si, comme moi, vous préférez l’orthographe traditionnelle, ou c’est ce que votre client exige, il suffit de changer les options dans Word. Cette vidéo vous expliquera comment le faire.

Share:

Translator productivity – video 3: Verbatim Google searches

Google used to allow the plus symbol to be used for verbatim searches, forcing Google to search for exactly what we type in, rather than trying to guess what we might mean. When Google introduced Google+, they removed this usage of the plus sign, and informed users that they should use quotation marks instead. Only problem is, as shown in the video, this new method is not reliable.

In the video, I demonstrate how using the plus symbol and the quotation marks don’t work, and show you how to make sure you perform a verbatim search.

Link mentioned in the video for performing verbatim searches: Translator productivity – video 2: https://www.google.com/webhp?tbs=li:1

File to add Google verbatim searches to Intelliwebsearch: IWS Google verbatim.

Share:

Translating graph and table labels from Spanish/Catalan to English

It is easy to fall into the trap of using literal translations when labelling graphs and tables, but we should try to look for translations that sound more natural. Here are a few quick thoughts on translating some of the expressions that often come up in Spanish (Catalan) texts:

Illustración/Gráfico (Il·lustració/Gràfic)

Usually followed by a number. These labels usually refer to some kind of graph. I would suggest translating it as Figure.

Evolución de… (Evolució de…)

My current project has the following label for one of the graphs:

Evolució del dèficit d’habitatge a Seül, 1926 – 2009

If the project had been in Spanish it would have read:

Evolución del déficit de vivienda en Seúl, 1926 – 2009

Evolución (Evolució) is always a tricky word to translate. The English cognate, evolution, is not used nearly as frequently as the Spanish (Catalan) word.

In the context of graphs, the Spanish and Catalan words usually refer to the fact that the graph shows information over a period of time. My suggestion here is simply to leave it out in the English, since the date in the label already makes it clear that the data refer to a period of time (if the date range is not in the Spanish or Catalan label or title, we could add it).

So, my translation of the Catalan was as follows:

Housing shortage in Seoul, 1926-2009

Elaboración propia (Elaboració pròpia)

Anyone who translates from Catalan to English will, at some point, have had the headache of having to translate the phrase llengua pròpia. Part of the problem is that in English we can’t normally use the word own next to a noun without an accompanying possessive pronoun such as his or my.

An additional problem with the designation elaboración propia (elaboració pròpia) is that elaboración (elaboració) and elaboration are false cognates. The English word implies adding more detail to something, rather than producing something.

Based on my experience of texts written in English, my suggestion is to translate the phrase as Author’s work, or if the document has more than one author, Authors’ work (NB: make sure you double check whether you need the singular or plural possessive if it comes up as an “exact” match from your translation memory, as your previous project might have had a different number of authors!)

Do you agree with my proposed translations? What other tricky terms do you often see next to tables and graphs?

Share:

Macro to replace smart quotes and smart apostrophes with straight quotes and straight apostrophes in Word

UPDATE: I no longer recommend this macro because it does not look at footnotes and text boxes. Instead, you should use the macro available here.

Many users of CAT tools like to convert smart quotes and apostrophes to straight ones before translating their documents, because if the straight versions are always used, it means concordance searches for words including apostrophes will always work.

The problem is that it takes quite a while to do this in MS Word. You can’t just find/replace the apostrophes, because even if you put a straight apostrophe in the replace box, Word will interpret it as a smart apostrophe if you have set Word up to use straight apostrophes and quotes.

Of course, you could change that setting, but then it is more complicated to convert the straight varieties to the smart varieties after exporting from your CAT tool.

The solution is to use a macro that will automatically switch smart quotes and apostrophes off, then perform the search, then switch them back on.

Here’s a macro that will do just that.

Option Explicit
Sub ReplaceQuotes()
' ReplaceQuotes Macro, by Timothy Barton, Anglo Premier Translations
'
Application.Options.AutoFormatAsYouTypeReplaceQuotes = False
Selection.find.ClearFormatting
Selection.find.Replacement.ClearFormatting

With Selection.find
.Text = ChrW(8220)
.Replacement.Text = """"

.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

End With
Selection.find.Execute Replace:=wdReplaceAll

Selection.find.ClearFormatting
Selection.find.Replacement.ClearFormatting
With Selection.find
.Text = ChrW(8221)
.Replacement.Text = """"

End With
Selection.find.Execute Replace:=wdReplaceAll

Selection.find.ClearFormatting
Selection.find.Replacement.ClearFormatting
With Selection.find
.Text = "´"
.Replacement.Text = "'"

.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

End With
Selection.find.Execute Replace:=wdReplaceAll

Selection.find.ClearFormatting
Selection.find.Replacement.ClearFormatting
With Selection.find
.Text = "‘"
.Replacement.Text = "'"

.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

End With
Selection.find.Execute Replace:=wdReplaceAll

Selection.find.ClearFormatting
Selection.find.Replacement.ClearFormatting
With Selection.find
.Text = "’"
.Replacement.Text = "'"

.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.find.Execute Replace:=wdReplaceAll
Application.Options.AutoFormatAsYouTypeReplaceQuotes = True

Dim oShell As Object
Dim iResponse As Integer
Set oShell = CreateObject("Wscript.Shell")

iResponse = MsgBox("Procedure complete. Code provided by Timothy Barton, Anglo Premier Translations. Would you like to visit the website?", _
vbYesNo, "Procedure complete")

If iResponse = vbYes Then
oShell.Run ("http://www.anglopremier.com?utm_campaign=apostrophesmacro&utm_medium=referral&utm_source=blog")
Else
Exit Sub
End If

End Sub

Share:

Automatically move footnotes after punctuation, rather than before, in Word

Texts in Romance languages usually place footnote markers before punctuation. In English we place them after the punctuation. I usually change this on the fly while translating, but I’ve just received a text I outsourced because it was Italian-English and the translator hasn’t moved the footnote markers. No worries! There’s no need to go through the footnotes one by one, as a quick find-and-replace routine in Word will put the footnote markers in the right place (if you prefer, you’ll find a macro at the bottom of the page). Open up the find/replace box, select “Use wildcards”, and enter the following:

Find: (^2)([.,:;\?\!])
Replace: \2\1

It should be safe to use Replace All, but if you want to play safe you can click the Find button once and then keep clicking Replace.

Explanation:
^2 = Footnote reference (same as ^f without wildcards)
[ ] = Look for any character contained in the square brackets. The ? and ! are preceded by a backslash because they normally have special meanings. The backslash tells Word to ignore the special meaning and look for a literal ? or !.
\2 = Replace with the contents of the second parenthesis
\1 = Replace with the contents of the first parenthesis

If you wish to do the opposite conversion, to convert the English format to that used by the Romance languages, run the following procedure, also with wildcards:

Find: ([.,:;\?\!])(^2)
Replace: \2\1

If you have to perform either of these regularly you may want to create a macro. Here’s the code for converting to the English format:

Sub MoveFootnotesForEnglish()
'
' Macro by www.anglopremier.com (thanks to Simon Turner for converting to macro format)
' Moves footnote markers to after punctuation
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(^2)([.,:;\?\!])"
.Replacement.Text = "\2\1"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

For those of you working from English to Romance languages, here’s the macro for you:

Sub MoveFootnotesForEnglish()
'
' Macro by www.anglopremier.com (thanks to Simon Turner for converting to macro format)
' Moves footnote markers to before punctuation
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "([.,:;\?\!])(^2)"
.Replacement.Text = "\2\1"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Share: