Skip to content

Instantly share code, notes, and snippets.

@yu-tang
yu-tang / adapt_tags_to_match_target.groovy
Last active July 10, 2017 20:57
adapt_tags_to_match_target.groovy
/* :name=Adapt standard tags :description=Adapt standard tags when Replace with Match command invoked
*
* The workaround by script for RFE #841:
* Adapt tags to match target
* http://sourceforge.net/p/omegat/feature-requests/841/
*
* | Editor | Match
* -------+--------------+--------------
* Source | <a1>foo</a1> | <a9>foo</a9>
* -------+--------------+--------------
@yu-tang
yu-tang / KeyTextList.groovy
Created June 24, 2015 16:47
getKeyText の中身を列挙
//def res = new sun.awt.resources.awt_ja()
def res = new sun.awt.resources.awt()
res.getContents().each {console.println "${it[0]}, ${it[1]}"}
@yu-tang
yu-tang / result.txt
Created June 5, 2015 16:47
test for OmegaT tokenizers
org.omegat.tokenizer.LuceneEnglishTokenizer
--------------------
0. "fooled"
1. "by"
2. "a"
3. "smile"
org.omegat.tokenizer.LuceneJapaneseTokenizer
--------------------
0. "fooled"
@yu-tang
yu-tang / enumFilteredSegments.groovy
Last active November 19, 2015 20:16
Enumerate filtered segments.
console.println 'Enumerate filtered segments.'
def entries = project.allEntries
def filter = editor.filter ?: [allowed: {true}]
def found = entries.findAll { filter.allowed it }
// Do something for each SourceTextEntry here
found.each {
// get translation info
def info = project.getTranslationInfo(it)
@yu-tang
yu-tang / PoC_segment_shortcut.groovy
Last active August 29, 2015 14:11
PoC for segment shortcut
/*
* PoC for segment shortcut
*
* Related RFE : http://sourceforge.net/p/omegat/feature-requests/1038/
* Hint : Put this script to <ScriptsDir>/application_startup folder
* to automatically execution at every time OmT launching.
*
* @author Yu Tang
* @date 2014-12-21
* @version 0.1
@yu-tang
yu-tang / enable_jython.groovy
Last active August 29, 2015 14:11
Allow to support Jython for OmegaT Scripting
/*
* Allow to support Jython for OmegaT Scripting
*
* Usage: step 1. Get embedding Jython from http://www.jython.org/
* step 2. Adjust config setting and run this script
* Note : It's enabling Jython just while current session.
* Hint : Put this script to <ScriptsDir>/application_startup folder
* to automatically execution at every time OmT launching.
* Caution: This script is very hacky. Proceed at your own risk.
*
@yu-tang
yu-tang / trc2tmx.groovy
Last active August 29, 2015 14:10
翻訳Atlas の対訳ファイル(.trc)を TMX ファイルに変換する OmegaT 用スクリプト
/** :name=.trc を TMX に変換 :description=翻訳Atlas の対訳ファイル(.trc)を TMX ファイルに変換する
*
* 翻訳Atlas の対訳ファイル(.trc)を TMX ファイルに変換する OmegaT 用スクリプト
*
* .trc のデータ形式は、下記を参照した。
*
* ATLAS で gettext PO ファイルの翻訳をしたい その2
* http://ta-memo.blogspot.jp/2011/05/atlas-gettext-po-2.html
*
* 使い方:
@yu-tang
yu-tang / config.groovy
Created September 18, 2014 15:51
How to set Microsoft Translator credentials with Java Web Start version of OmegaT
/***
* required: OmegaT 3.1.3 or later
* this file must be saved at the inside of <your-scripts-folder>/application_startup/ folder.
***/
new ConfigSlurper().parse("""
// ***** CONFIG START: EDIT BELOW *****
/*** Google Translate v2 API key ***/
//google.api.key='xxxxx'
@yu-tang
yu-tang / MergeDocs.vbs
Last active August 29, 2015 14:06
Merge two .docx files paragraph-by-paragraph.
'*********************************************************************
' MergeDocs.vbs
' Merge two .docx files paragraph-by-paragraph.
'---------------------------------------------------------------------
' Author : Yu Tang
' Version : 0.1.1
' Lisence : GPLv3
' Required : Microsoft Word installed.
' Usage : 1. D&D source file from OmegaT project source dir.
' or
@yu-tang
yu-tang / BinaryReader.cls
Last active August 29, 2015 13:59
BinaryReader for VBA
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "BinaryReader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Compare Binary