![]() # f = codecs.open(self.path_to_watch, "r","utf-8")į = codecs.getreader('utf-8-sig')(open(self.path_to_watch,'r')) #To prevent BOM This behavior can be implemented with following code. When user or in this case "VB code" clicks Segment Opener, TW reads get_posinfo.dat and know where to jump. When user click this menu it read segment id info from a custom dat file get_posinfo.dat which is a tab-separated two colums(ID and XLZ file path) text file. This code registers a menu item Segment Opener in Tools menu with OpenFileWithID method. _('Segment Opener Bilingual String Comparer'),Īctiongroup = gtk.ActionGroup('plugin_by_hee') ( "plugin_by_hee", gtk.STOCK_JUMP_TO, #Icon see Self.path_to_watch = getConfigRoot().abspath() + " \\plugin_settings\\segment_opener\\get_posinfo.dat" #self.path_to_watch = transolution.get_external_plugins_dir() + " \\bilingual_string_comparer\\get_posinfo.dat" Plugin._init_(self,application,uimanager,log,settings) In order to register a custom command and show it in the TW interface you need a Class that contain particular initialization code:ĭef _init_(self,application,uimanager,log,settings): When you restart XLIFF Editor, those python scripts are automatically compiled into *.pyc. The xliff_references.py file is copied from a default plugin called batch_searchreplace which is included with XLIFF Editor. In this demo there is _init_.py, SegmentOpener.py, and xliff_references.py. This folder must contain _init_.py file from which other scripts are included and called. To deploy XLIFF Editor script (*.py), you simply create a new folder such as segment_opener and put it in pulugins folder of TW installation directory, which is defaulted to:Ĭ:\Documents and Settings\All Users\Application Data\Translation Workspace XLIFF Editor\plugins\segment_opener It's still impossible to work with XLIFF Editor "directly" from VB, but It is possible to create custom python script with accelerator like Ctrl + Alt + B and send the key combination to the script from VB using SendKeys function. Now he wants to use it with GeoWorkz Translation Works XLIFF Editor.Īs a result of further investigation I've finally found a workaround. This tool however was originally intended for use with Word and TagEditor. I developed this useful tool for him six or seven years ago. There is no explicit interface or compatibility between those languages such as COM.īy the way this check utility named Bilingual String Comparer is able to compare a should-be-left-as-is element such as numbers, alphanumeric, or Camel words (such as 1234, 123a or ABC_DEF) between source and target segment. The other day, one of my colleagues asked me a question "Is there any way to use Visual Basic-based check utility to work with GeoWorkz Translation Works XLIFF Editor." Of course I answered "No," because the scripting language for XLIFF Editor is python while that for the utility is VB. Programming itself is kind of my hobby, I often develop CAT tool as needed or when I asked from colleague to do so. ![]() ![]() It's almost ten years since I started translation business as a freelancer. I specialize in translation of IT documents particularly for programming languages including C, C#, VB, python, etc., databases such as SQL Server, and recently medical devices so called "modality" such as CT and MR. I'm as a freelancer providing an English to Japanese translation service in Localization business. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |