There's nothing here yet
Recently Browsing 0 members
No registered users viewing this page.
I use Chrome's 'Translate this page' functionality quite a lot at work. My workflow is usually translating the page to english so I know what it is about, finding correct lines, translating it back to the original language so I can grab the correct XPath (since translating it, updates the structure and most importantly the text displayed, obviously), and rinse and repeat.
Since I do it all the time, each unnecessary click in the end amounts to quite some time I would rather be spending actually working. You have to click the translate button, it asks whether you want to translate the page, you have to click yes. Then sometimes the little window is in the way so you click it off but when you need to translate back to the original language you have to click the little icon again.
How would one go about automating it?
Checked the forum and it seems that the old Chrome UDF doesn't work and the best way for interacting with Chrome is the WebDriver UDF which, from what I've read and tested a bit, creates a new, different instance of Chrome.
I tried using the good old MouseClick but I don't find it reliable. Also ControlClick seems to be out of the picture since the whole Chrome window is "one single control".
Any ideas are appreciated.
Hello I'm trying to translate few text using below code, I found it working previously couple of months ago but Now these days it's not working at all and I'm getting below errors when I run the script and Array display at the end of text also not able to show any translated text instead of value 0 & 1;
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (gt-res-data)
--> IE.au3 T3.0-2 Error from function _IEPropertyGet, $_IESTATUS_InvalidDataType
Here is code,
#include <IE.au3> #include <Array.au3> Local $tag="* # * # *" Local $oIE=_IECreate("https://translate.google.com/#auto/es") Local $oForm=_IEFormGetCollection($oIE,0) Local $oQuery=_IEGetObjByName($oForm,"text") _IEFormElementSetValue($oQuery, $tag & @CR & "Hello World" & @CR & "This is a test" & @CR & $tag) _IEFormSubmit($oForm) _IELoadWait($oIE) Local $oText=_IEGetObjById($oIE,"gt-res-data") $lines=StringSplit(_IEPropertyGet($oText,"innerText"),@CRLF,1) _IEQuit($oIE) _ArrayDelete($lines,_ArraySearch($lines,$tag,1,0,0,1,0) & "-" & $lines) _ArrayDelete($lines,"1-" & _ArraySearch($lines,$tag,1,0,0,1,1)) $lines=UBound($lines)-1 _ArrayDisplay($lines)
Here is a tool coded in AutoIt to edit multiple ini files ( up to 8 at the same time) to include multilanguage support in your script.
The script himself have multilanguage support, simply by using :
To change language, i read my global.ini file witch inform me what ini file i had to use...
ConsoleWrite ( _string_lang(19) ) Func _string_lang($number) $number = _StringRepeat("0",6-StringLen($number)) & $number $string = IniRead($my_ini_folder & $interface_ini_file,"STRING",$number,"NOT_FOUND") Return($string) EndFunc
where 19 is the 19 string in ini file witch look like this :
Todo : Initial ini file not necessarily "english.ini"
Feel free to use it, give me idea, critical or bug found.....
As i am french please be gently
While developing an AutoIt-based application for an international christian organization, the need came up to provide this application for users of different native languages. So MsgBox(64, "App Title", "Please reboot your computer to complete the process.") is no longer good enough. The application needs to present its user interface in a different language, depending on the user’s preference.
Of course there are many approaches to implement this. But however you do it, you will need two different toolkits: one for the translator and one for the programmer.
The programmer will need something to define the translatable strings or, preferably, extract them from the source code.
The translator will need something to edit the translation.
The programmer will need something to incorporate the translation in to the program.
And all of this should be repeatable with little effort when a few strings in the program change – don’t make the translator retranslate everything if you just add two strings for a new little feature of your program.
To avoid reinventing the wheel, I decided to go the route many large open source projects go: gettext.
So I've built a small toolkit utilizing the style and some tools of GNU gettext to create AutoIt applications that can be translated into any language by just adding a corresponding [language].po file.
I've explained the reasoning and overview in https://martinstutenglish.wordpress.com/2016/06/10/internationalizing-autoit-applications-by-something-similar-to-gnu-gettext/
Technical details and downloadable files, including a very small example application, are in https://github.com/martinstut/gettext_au3 (updated as I improve the toolkit), most of which is also contained in the attached ZIP file.
Hopefully this helps you to internationalize your own applications.