Compact glossary layout updated

As announced previously, an alternative glossary pane layout was made available as a plugin. The newest update (v.1.1.0) now includes 4 variants of that compact layout:

  • 1A
    • source: target [comment] | target [comment] | [comment] (separator | is styled as normal text — the same as in the original version)
  • 1B
    • source: target [comment] | target [comment] | [comment] (separator | is styled as target terms)
  • 2A
    • source: target (comment), target (comment), (comment) (separator , is styled as normal text)
  • 2B
    • source: target (comment), target (comment), (comment) (separator , is styled as target terms)

Once again, here’s the project itself, and here is where you can download the compiled version. If you run OmegaT on Java8, make sure to download the right build. On Java11 it doesn’t matter which build is used.

Comments, bug reports, complains, latest gossips and donations are always welcome.

Take care and good luck!

Export #OmegaT Project to Excel (UPDATE)

The earlier version of this script was described in this article. Here I’m announcing the update to the script which makes it possible to include:

  • Segment ID for each segment (applicable only for some file types)
  • Translator’s ID of the segment’s translation creator
  • Translator’s ID of the segment’s translation editor
  • Segment notes
  • Visual marks to show segments’ uniqueness or repetitions (grayish background, marks 1 or + in the dedicated column: for the first occurrence, or further instances of the repeated segment, respectfully)
  • Visual marks for alternative translations (different font color, mark a with a different background in the dedicated column)
  • Visual marks for untranslated segments (mark NT in the dedicated column)
  • Visual marks for paragraph boundaries (upper border over the source and target text which visually groups the text belonging to the same paragraph)

All of the above features are optional, though they are on by default. To disable or change them, editing the script is required, but all those lines are very easy to understand, they have comments, and are placed almost in the very beginning of the script:

Scripting window with the script options in focus

Unlike the earlier version, the script produces the tabular output:

Segment #Source TextTarget TextUniq/AlSegment IDCreatorChangerNote

The script can be downloaded from
SF.net repository
GitHub repository

Comments, suggestions, complains and donations are always welcome!

Happy spreadsheeting!

Export OmegaT project to an HTML table

A few years ago I wrote a script that exported the whole OmegaT to an HTML table. I used it a lot myself, and I know quite a few other people found it helpful too. The problem with the table produced by that script was that it had no way to show repeated or alternatively translated segments. I’ve rewritten the script since, but never published an announcement about that new version. Now I did a few more changes, and thought that it’s about time to fix that omission.

Continue reading

Alternative OmegaT Glossary Layout

It has been possible for quite some time now to choose which Glossary pane layout to use in OmegaT. Selection isn’t that great, only two layouts are provided: Default and Dictionary. But at the same time this feature had been introduced, it became possible to add custom layouts via plugins. I haven’t seen any, but the possibility is there. And just recently, Hiroshi Miura, a very prolific OmegaT developer, published a plugin skeleton just for this purpose. I used what he generously shared, and made an alternative compact layout for the Glossary pane.

It puts target terms right after the source term on the same line, and separates them only by a vertical bar and spaces. If there’s a comment for the term, it follows it immediately enclosed in square brackets. If OmegaT is set up to merge multiple target definitions for the same source term, and there are duplicated entries (i.e. two or more identical target terms for the same source term) with different comments, the comments will be separated by the vertical bar, but the term itself won’t be repeated.

To enable this layout in OmegaT, download the plugin (the ready-to-use jar is in the Releases section), put it into plugins subfolder in your OmegaT config folder, restart OmegaT, and select it under PreferencesGlossaryGlossary layout: → Compact Glossary Layout

Happy translating!

A [slightly more] sane initial OmegaT setup. Part I

Over the years of my daily use of OmegaT (I started using it back in 2009), I helped quite a few translators to make their first steps with the program. The funny thing is that almost every time a new person tries to learn the program, we change some of the same defaults to make it more usable and comfortable. So I thought it might be a good idea to collect those few initial setup changes here as a small series of posts so that anyone could refer to them at any point.

The first thing I always have new users change is the Editor behavior.

Continue reading

OmegaT Live preview (based on LibreOffice)

Below you’ll find a quick and dirty live preview solution for OmegaT on GNU/Linux.

In order for it to work, you’ll need any command line converter to convert your target files to PDF, and any PDF viewer to view the converted file. In the solution provided here Zathura PDF viewer is used. It is a very lightweight, keyboard-driven (albeit with vi-like keybindings) application that can invert document colors using a custom color scheme, and, most importantly, it reloads documents as they are changed, but keeps the previously open position, which makes it ideal for live previewing. Target files are converted using LibreOffice since I had it installed anyway; but any other command line tool that converts to PDF would do.

Continue reading

Merging and Splitting Segments in #OmegaT without editing segmentation rules.

One of the complaints OmegaT gets is the impossibility to split and merge segments without editing projects’ or global segmentation rules.  There were a few attempts to address the issue, but they required a third-party utility that would edit segmentation.conf. One of the most recent attempts was Dimitry Prihodko’s Merge utility (don’t bother to download it, it won’t work as expected, just read on). If I understood it right, Dimitry asked Yu Tang to rework his thingy, and Yu Tang came up with a Groovy script that did all the merging using only OmegaT internals. It wasn’t limited to any OS or dependent on other tools (so much for hard Pascal coding, Dimitry). There was only a minor issue that the script couldn’t be used to split segments. And that’s what I’ve added and what I’m sharing here. Continue reading

#ISO 9:1995 #Transliteration in #OmegaT

This short announcement might be of some interest to those OmegaT users who work with Cyrillic text. Below you’ll find a script that transliterates current target or selection according to transliteration standard ISO 9 (one of the very few reversible Cyrillic translit systems).  The script is a tiny adaptation of the one discussed in the article Translit для JavaScript.

All you need to do is to copy it into your scripts folder and run it when there’s something you need transliterated (can be run multiple times — it’ll toggle the text between Cyrillic and Latin). If the text is not transliterateable, the script will not change it.

Here’s the link to the script: http://pastebin.com/npXEthmc (download).

//:name=Utils - Translit :description=Transliterate current target or selection
/*******************************************************************************
* @Name   : "translit(a, b)"                         // Имя
* @Params :   str  - транслитерируемая строка        // Параметры запуска
              typ  - [123456]
                   system A = 1-диакритика
                   system B =(2-Беларусь;3-Болгария;4-Македония;5-Россия;6-Украина)
                   Если typ отрицательное - обратная транслитерация
* @Descrp : Прямая и обратная транслитерация         // Описание
            по стандарту ISO 9 или ISO 9:1995 или ГОСТ 7.79-2000 системы А и Б
* @ExtURL : ru.wikipedia.org/wiki/ISO_9              // Внешний URL
* #Guid   : {E7088033-479F-47EF-A573-BBF3520F493C}   // GUID
* @Exampl : "example()"                              // Пример использования
* GPL applies. No warranties XGuest[11.02.2015/03:44:01] translit [ver.1.0.1]
*******************************************************************************/
var dia = false;
//var loc = java.util.Locale.getDefault().getLanguage();
var prop = project.getProjectProperties();
var ste = editor.currentEntry;
if (editor.selectedText){
	var target = editor.selectedText;
	}else{
	var target = editor.getCurrentTranslation();
	}

var tlcode = prop.getTargetLanguage().getLanguageCode();
var suplang = ["BE", "BG", "MK", "RU", "UK"];

if ((/[\u0400-\u04ff]+/ig).test(target)){
	transcode = suplang.indexOf(tlcode) ? suplang.indexOf(tlcode) + 2 : 0 ;
	transcode = dia ? 1 : transcode ;
	}else{
	transcode = suplang.indexOf(tlcode) ? -(suplang.indexOf(tlcode) + 2) : 0 ;
	transcode = dia ? -1 : transcode ;
	}

exports = function (str, typ) {
 var func = function (typ) {
 /* Function Expression
  * Вспомогательная функция.
  *
  * В ней и хотелось навести порядок.
  *
  * Проверяет направление транслитерации.
  * Предобработка строки (правила из ГОСТ).
  * Возвращает массив из 2 функций:
  *  построения таблиц транслитерации.
  *  и пост-обработки строки (правила из ГОСТ).
  *
  * @param  {Number} typ
  * @return {Array}
  */
  var abs = Math.abs(typ);             // Абсолютное значение транслитерации
  if(typ === abs) {                    // Прямая транслитерация(кирилица в латиницу)
   // Правила транслитерации (из ГОСТ).
   // "i`" только перед согласными в ст. рус. и болг.
   //  str = str.replace(/(i(?=.[^аеиоуъ\s]+))/ig, "$1`");
   str = str.replace(/(\u0456(?=.[^\u0430\u0435\u0438\u043E\u0443\u044A\s]+))/ig, "$1`");
   return [                            // Возвращаем массив функций
    function (col, row) {              // создаем таблицу и RegExp
     var chr;                          // Символ
     if(chr = col[0] || col[abs]) {    // Если символ есть
      trantab[row] = chr;              // Добавляем символ в объект преобразования
      regarr.push(row);                // Добавляем в массив RegExp
     }
    },
    // функция пост-обработки
    function (str) {                   // str - транслируемая строка.
    // Правила транслитерации (из ГОСТ).
    return str.replace(/i``/ig, "i`"). // "i`" только перед согласными в ст. рус. и болг.
    replace(/((c)z)(?=[ieyj])/ig, "$2");// "cz" в символ "c"
    }];
  } else {                             // Обратная транслитерация (латиница в кирилицу)
   str = str.replace(/(c)(?=[ieyj])/ig, "$1z"); // Правило сочетания "cz"
   return [                            // Возвращаем массив функций
    function (col, row) {              // Создаем таблицу и RegExp
     var chr;                          // Символа
     if(chr = col[0] || col[abs]) {    // Если символ есть
      trantab[chr] = row;              // Добавляем символ в объект преобразования
      regarr.push(chr);                // Добавляем в массив RegExp
     }
    },
   // функция пост-обработки
   function (str) {return str;}];      // nop - пустая функция.
  }
 }(typ);
 var iso9 = {                          // Объект описания стандарта
   // Имя - кириллица
   //   0 - общие для всех
   //   1 - диакритика         4 - MK|MKD - Македония
   //   2 - BY|BLR - Беларусь  5 - RU|RUS - Россия
   //   3 - BG|BGR - Болгария  6 - UA|UKR - Украина
   /*-Имя---------0-,-------1--,---2-,---3-,---4-,----5-,---6-*/
 "\u0449": [   "", "\u015D",   "","sth",   "", "shh","shh"], // "щ"
 "\u044F": [   "", "\u00E2", "ya", "ya",   "",  "ya", "ya"], // "я"
 "\u0454": [   "", "\u00EA",   "",   "",   "",    "", "ye"], // "є"
 "\u0463": [   "", "\u011B",   "", "ye",   "",  "ye",   ""], //  ять
 "\u0456": [   "", "\u00EC",  "i", "i`",   "",  "i`",  "i"], // "і" йота
 "\u0457": [   "", "\u00EF",   "",   "",   "",    "", "yi"], // "ї"
 "\u0451": [   "", "\u00EB", "yo",   "",   "",  "yo",   ""], // "ё"
 "\u044E": [   "", "\u00FB", "yu", "yu",   "",  "yu", "yu"], // "ю"
 "\u0436": [ "zh", "\u017E"],                                // "ж"
 "\u0447": [ "ch", "\u010D"],                                // "ч"
 "\u0448": [ "sh", "\u0161"],                                // "ш"
 "\u0473": [   "","f\u0300",   "", "fh",   "",  "fh",   ""], //  фита
 "\u045F": [   "","d\u0302",   "",   "", "dh",    "",   ""], // "џ"
 "\u0491": [   "","g\u0300",   "",   "",   "",    "", "g`"], // "ґ"
 "\u0453": [   "", "\u01F5",   "",   "", "g`",    "",   ""], // "ѓ"
 "\u0455": [   "", "\u1E91",   "",   "", "z`",    "",   ""], // "ѕ"
 "\u045C": [   "", "\u1E31",   "",   "", "k`",    "",   ""], // "ќ"
 "\u0459": [   "","l\u0302",   "",   "", "l`",    "",   ""], // "љ"
 "\u045A": [   "","n\u0302",   "",   "", "n`",    "",   ""], // "њ"
 "\u044D": [   "", "\u00E8", "e`",   "",   "",  "e`",   ""], // "э"
 "\u044A": [   "", "\u02BA",   "", "a`",   "",  "``",   ""], // "ъ"
 "\u044B": [   "",      "y", "y`",   "",   "",  "y`",   ""], // "ы"
 "\u045E": [   "", "\u01D4", "u`",   "",   "",    "",   ""], // "ў"
 "\u046B": [   "", "\u01CE",   "", "o`",   "",    "",   ""], //  юс
 "\u0475": [   "", "\u1EF3",   "", "yh",   "",  "yh",   ""], //  ижица
 "\u0446": [ "cz",      "c"],                                // "ц"
 "\u0430": [  "a"],                                          // "а"
 "\u0431": [  "b"],                                          // "б"
 "\u0432": [  "v"],                                          // "в"
 "\u0433": [  "g"],                                          // "г"
 "\u0434": [  "d"],                                          // "д"
 "\u0435": [  "e"],                                          // "е"
 "\u0437": [  "z"],                                          // "з"
 "\u0438": [   "",      "i",   "",  "i",  "i",   "i", "y`"], // "и"
 "\u0439": [   "",      "j",  "j",  "j",   "",   "j",  "j"], // "й"
 "\u043A": [  "k"],                                          // "к"
 "\u043B": [  "l"],                                          // "л"
 "\u043C": [  "m"],                                          // "м"
 "\u043D": [  "n"],                                          // "н"
 "\u043E": [  "o"],                                          // "о"
 "\u043F": [  "p"],                                          // "п"
 "\u0440": [  "r"],                                          // "р"
 "\u0441": [  "s"],                                          // "с"
 "\u0442": [  "t"],                                          // "т"
 "\u0443": [  "u"],                                          // "у"
 "\u0444": [  "f"],                                          // "ф"
 "\u0445": [  "x",      "h"],                                // "х"
 "\u044C": [   "", "\u02B9",  "`",  "`",   "",   "`",  "`"], // "ь"
 "\u0458": [   "","j\u030C",   "",   "",  "j",    "",   ""], // "ј"
 "\u2019": [  "'", "\u02BC"],                                // "’"
 "\u2116": [  "#"]                                           // "№"
  }, regarr = [], trantab = {};
 for(var row in iso9) {func[0](iso9[row], row);} // Создание таблицы и массива RegExp
 return func[1](                       // функция пост-обработки строки (правила и т.д.)
  str.replace(                         // Транслитерация
  new RegExp(regarr.join("|"), "gi"),  // Создаем RegExp из массива
  function (R) {                       // CallBack Функция RegExp
   if(                                 // Обработка строки с учетом регистра
    R.toLowerCase() === R) {
    return trantab[R];
   } else {
    return trantab[R.toLowerCase()].toUpperCase();
   }
  }));
};


if (! target){
	console.println("Target is empty");
	} else {
	var newtarget = exports(target, transcode)
	if (newtarget == target){
		console.println("Could not transliterate");
		}else{
		if (editor.selectedText){
			editor.insertText(newtarget);
			}else{
			editor.replaceEditText(newtarget);
			}
		console.clear();
		console.println(target + "\n↓\n" + newtarget);
		}
	}

Changing line 16 from ‘false’ to ‘true’ will make the script use diacritics for transliteration.