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:

AutoHotkey script to move the focus away from the Concordance window

Sometimes you want to keep the MemoQ Concordance window open on your second screen while you work on your document. But there’s no built-in method to achieve this with the keyboard. You can only do so by clicking with the mouse.

This short script moves the focus away from the Concordance window and to the main MemoQ window, allowing you to work on the document while keeping the Concordance window open. Just press ctrl+k to activate the script.


#IfWinActive, Concordance
^k:: ; MemoQ: Move focus away from Concordance window
WinActivate memoQ
#IfWinActive
return

The following script closes the Concordance window. Continue reading

Share:

On the usefulness of machine translation (hear me out!)

Colleagues who know me know that I’m not a proponent of offering machine translation post-editing as a service. There is just so much to fix in a machine-translated text that it’s not a productive way of working, especially if you’re a perfectionist like me, who would find it to difficult to leave a sentence alone if the translation can be understood but could be improved.

Nevertheless, I don’t belong to the camp who believe that machine translation (MT) is never useful. In fact, I challenge anyone to tell me that MT would not save them time if they were translating the following sentence.

Continue reading

Share:

“Pain of the field” es lo de menos

Varios medios españoles y internacionales nos han ofrecido la noticia esta semana de que la web del Ministerio de Industria, Comercio y Turismo tiene una noticia en inglés sobre el nombramiento de un tal “pain of field” como miembro del Oficina Internacional de Pesas y Medidas. Este nombre raro es el resultado de la traducción automática del nombre de Dolores del Campo.

Una de las noticias más compartidas sobre el tema es bastante sorprendente: la de Euronews tiene un inglés muy deficiente, probablemente como resultado de una traducción automática.

Otra cosa que me ha sorprendido Continue reading

Share:

Windows updates: “Requires a restart to finish installing”

The latest major Windows update, version 1803 (but this solution applies to other versions too), wouldn’t install on my computer. On the Windows update dialogue window, it constantly said “Requires a restart to finish installing”, even though I’d restarted the computer several times.

I eventually found the solution in the message by dckeks on this forum.

The first scan he suggests came back clean. I then entered the second command and restarted, and I was then able to install the update.

He provides additional instructions in a later post if the first two methods don’t work.

Share:

Save 20% on MemoQ

Use this link to get a 20% discount on a memoQ translator pro licence.

Avec ce lien vous obtiendrez un rabais de 20% sur une licence “memoQ translator pro”.

Utilice este enlace para obtener un descuento de 20% en una licencia “memoQ translator pro”.

Amb aquest enllaç, podeu obtenir un 20% de descompte en una llicència “memoQ translator pro”.

Share:

Dialogue boxes slow to open in Word

A problem I’ve been experiencing for quite a while on my computer is that dialogue boxes have been very slow to open in MS Word and Excel. I assumed it was a result of the UBitMenu, a handy add-on that restores the old-style drop-down menus we used to use before Microsoft introduced the awful ribbon. I accepted it as a trade-off, since the delays were more than offset by the time I gained by finding option quicker thanks the drop-down menus (and being able to open up the drop-down menus thanks to a script I wrote).

But then things started getting really slow, and I’d also experienced some sluggishness in my browser. I trawled through the forums and found many people with the same problem, but nobody was proposing a solution that worked.

Then I read a post by someone who hypothesised that it was down to hard drives that were dying. The writer of the post (which I can no longer find) had the issue on two computers, both of which then experienced hard-drive failure. He then started working on a laptop that was more than 10 years-old, and therefore should have been much slower, and found that he no longer experienced the problem.

The hard drive that came with my computer has been playing up recently, with one of the partitions not working very well. Fortunately, I only use it as a backup drive, as I migrated my operating system and documents to a solid state drive several years ago (I recommend all my colleagues do the same, as will make your system much quicker), but it seems that even having the hard drive connected was slowing down my system, especially (for some reason) when opening and closing dialogue boxes in Word and Excel.

If you are experiencing the same issues, try disconnecting any old drives that no longer perform properly. Of course, if it’s the drive that your operating system is running on, then you can’t just disconnect it, but it’s a good excuse to buy a solid state drive, which will definitely speed up your system, even if it doesn’t fix this particular problem.

If, like in my case, the hard drive playing up is one that you can safely disconnect, but it is an internal drive, you don’t need to get out the screwdrivers. You can simply go to the device manager, select “Disk drives”, then right-click on the device that’s playing up and select “Disable device” (whatever you do, don’t do this on the device that runs your operating system!). After restarting your computer, check whether the problem has gone away.

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:

Preventing Windows updates from using up your bandwidth

Is your Internet connection running mysteriously slow? Perhaps you’ve noticed that it’s only slow when one computer is connected to the network?

That’s what happened to me today. While testing my wireless router in different parts of the building to see if the signal improved, I eventually realised that the connection was only slow when the router was connected to my desktop computer. Because the desktop computer is connected to the router using an Ethernet cable, it wasn’t connected while I was moving the wireless router around the building, which is when the speed improved.

As soon as I reconnected my desktop computer, I noticed that the speed went down again.

I then investigated what was using up all the bandwidth on that computer, concerned that I had some malware running in the background.

To do this, you can press ctrl+alt+del and open the Task Manager, select the Performance tab, then click on “Open Resource Monitor” at the bottom of the window.

Open resource monitor

Once in the resource monitor, open the “Network” tab, and you’ll see a list of the processes that are sending and receiving data. If the bandwidth is being consumed by Windows Updates downloads, you’ll notice that the amount of data being downloaded by “svchost.exe” is far higher than what other processes are downloading, as in the screenshot below.

ResourceMonitor

You can double-check whether Windows is doing updates by opening up the start menu and typing “Update”, then clicking on “Windows Update Settings”, which will open up the window shown below. This will also show you how much of the update has been downloaded. If you’ve already downloaded 98%, you might just want to let it finish, as the procedure described below will mean that you have to restart the download when you want to download the update.

WindowsUpdates

If you’re connected to your router wirelessly, then you could tell windows that your connection is metered. However, this may affect the behaviour of other software and prevent you from getting important software updates (which are generally much smaller, so they won’t take up bandwidth for hours on end). Also, Windows says that it delivers certain essential updates even on a metered connection, much to the chagrin (as evidenced by comments on numerous forums) of many users of metered connections, especially in developing countries where Internet usage per megabyte can be very expensive.

If you’re connected using an Ethernet cable, you can’t mark the connection as metered.

Many websites will tell you commands to stop the update service. The problem, though, is that since the “Anniversary” update of Windows 10, the service restarts itself, so we need to use an additional command to stop the service from automatically restarting.

First, open a command prompt as Administrator. To do this, open the start menu, type “cmd”, then press shift+ctrl+enter.

Once command prompt opens, type the following command to prevent the update service from restarting automatically once we stop it: sc configwuauserv start=disabled

Next, type in the following command to stop the Update service: net stop wuauserv

Finally, type in the following command to stop the Delivery Optimisation Service: net stop dosvc

Your command prompt should now look like the following screenshot.

StopWindowsUpdates

You can now close the window if you wish.

In the resource monitor, you should now begin to see the network activity of “svchost.exe” decrease. The number does not disappear immediately, as Windows calculates the download rate over the past minute, but wait 60 seconds and you should see the amount of data being downloaded by svchost.exe fall to less than 100B/sec.

When you do want to do the download (such as overnight), use the following commands to restart the services:

  • sc config wuauserv start=auto
  • net start wuauserv
  • net start dosvc
Share: