Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AHK as a translation assisting tool, replacing words


  • Please log in to reply
3 replies to this topic
Sieceres
  • Members
  • 25 posts
  • Last active: Jan 29 2015 08:03 AM
  • Joined: 17 Jan 2008
I'm pretty sure this can be done, but I don't know how! Let's say I'm translating from English to Spanish. What I would like to do is when I mark a word, let's say I mark the word "friend", it would be automatically replaced by "amigo" when I press a hotkey. The translation program I'm using "forces me" to do one sentence at a time, so the normal replace function will do no good.

Even better would be if it scans the sentence for known terms (upon pressing a hotkey) and automatically replaces them. Any ideas?

BoBo²
  • Guests
  • Last active:
  • Joined: --

Even better would be if it scans the sentence for known terms (upon pressing a hotkey) and automatically replaces them. Any ideas?

MyDictionary.txt
friend|Freund
BoBo|BoBo
colleague|Kollege
Run|Ausführen
Cancel|Abbrechen
Start|Start
Subject|Titel
FileRead, Content, My.txt ; Text to translate
Loop, Read, MyDictionary.txt
{
   StringSplit, Word, A_LoopReadLine, |
   StringReplace, Content, Content, %Word1%, %Word2%, All
   ClipBoard := Content ; keep changed text
   }
FileAppend, %Content%`n, MyTranslatedFile.txt
Run, Notepad MyTranslatedFile.txt,, Max
Not tested & and not exactly what you want, but should give you an idea ... 8)

Sieceres
  • Members
  • 25 posts
  • Last active: Jan 29 2015 08:03 AM
  • Joined: 17 Jan 2008
I tested it, but didn't get it to work... The "translated document" is empty. This is too advanced for me to correct. :(

Krogdor
  • Members
  • 1391 posts
  • Last active: Jun 08 2011 05:31 AM
  • Joined: 18 Apr 2008
Did you put a file called My.txt with the text to be translated in the directory with the script?