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 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:

Bookmarklet tweaks

I’ve corrected some of the bookmarklets I made available on my main website. All the bookmarklets now lead to the correct site, and the Oxford English Dictionary one now works with all words. There is also a link to a site explaining how to disable speed dial in Firefox, since the bookmarklets don’t work if you are on the speed dial page.

Share:

Translating Latex files in MemoQ

LaTeX is a format that uses tags to enable authors to not have to worry about typesetting their text. Unfortunately, at the time of writing there do not seem to be any CAT tools that accept this format. However, MemoQ lets you label tags using regular expressions. We have created a filter for importing LaTeX files into MemoQ. If you normally use a different CAT tool, you could import your file into MemoQ (you can use the demo version for up to 45 days) then export it into a format you can use in other CAT tools (for example, the XLIFF format).

To use the filter, download it here. Next, go to the Resource console in MemoQ and click on “Filter configurations”. Click “Import new” and add the file you just downloaded.

Now all you need to do is go to “Add document as” in a MemoQ project, click on the “Open” button in the Document import settings window and select “Latex all” from the list.

Share:

Conversion of Déjà Vu memories into MemoQ memories

If you export a Déjà Vu (DVX) memory or terminology database and import it into MemoQ, you lose some of the data such as the client, subject, project, user name and creation date. This is because the tmx format created by DVX does not match the tmx format created and understood by MemoQ. For example, Déjà Vu has separate creation dates and user IDs for the source and target, whereas MemoQ has a single creation date for a translation pair (which makes more sense). Also, the tmx created by DVX contains the subject and client codes, not the actual names. For example, if you used the subject “33 – Economics” in DVX, you will be importing the number “33” as the subject, not the word “Economics”. Similarly, if you used client codes, like “MST” for “Microsoft”, you’ll be importing the code rather than the full name.

Anglo Premier recently migrated from Déjà Vu to MemoQ. After much labour we succesfully converted our translation memories and terminology databases, preserving all the subject and client data and the dates. We initially described the process on this blog, but the procedure is complicated to follow and the script we created won’t run properly on all versions of Windows. It also requires the user to have Excel and Access 2003. Instead, we are offering to convert your translation memories and terminology databases for you. For a fee of €20 or £16.50 we will convert a translation memory or terminology database, and for €40 or £33 we will convert up to four databases. None of the content of your databases will be read and we will delete the databases from our system as soon as the conversion has been done and the file(s) have been sent to you.

If you wish to use this service, please contact us via the contact form on our main website.

Share:

Linguee

Linguee is an online tool that searches for online translations of terms. It was originally only available for English<>German, but French, Spanish and Portuguese have now been added. You have to look carefully at the sources use and check the results for reliability, but provided you do that it’s a very useful tool.

Linguee website

Spanish<>English toolbar button (drag to the toolbar if using Firefox)
French<>English toolbar button (drag to the toolbar if using Firefox)

Share:

Creating country-specific pages

When a company is looking for a translator, they are likely to include the name of their country or city in their online search. However, as any freelance translator knows, there is nothing to stop us working with clients anywhere in the world.

One way we can attract more potential clients is to create specific pages that target those living in a particular place.

Here is a list of the pages I have created for certain target markets. Note that many of the pages are written in the client’s target language. This list is also useful to ensure the pages are included in search engine indexes, since I don’t have links to any of these pages on my main site.

Share: