Howto - Creating a new file filter

Sorry this page has not yet been translated.

This HowTo explains how to create a new file filter for use with OmegaT by describing the creation of a rudimentary file filter for the TMX format. Although it might seem strange to want to translate TMX files (the usual reason for creating a file filter), the addition of a TMX filter has the interesting effect that it enables TMX files in any location to be searched for from within any OmegaT project using the "Search Files" function, something not possible in the standard OmegaT build.

Select an existing filter for a format similar to that for the new filter. In this example, the Help & Manual filter has been selected as a basis.

Locate the folder src/org/omegat/filters3/xml, and make a copy the subfolder /helpandmanual, naming it /tmx. In this folder, rename the two files HelpandManualDialect.java and HelpandManualFilter.java to TmxDialect.java and TmxFilter.java respectively.

Open the files TMXDialect.java and TMX filter in a text editor. In both files, search for (matching the case) and replace:

Identify the paragraph-level tag(s) for your new file format. To find out what the paragraph tags should be, examine a sample file in a text editor. In TMX, the paragraph-level tag corresponding to a segment is "tu".

as it is irrelevant to TMX, although the new filter will still work if you do not.

You can define out-of-turn tags. These define subsegments that are presented outside the segment in which they are contained (footnotes are a good example). To do this for the TMX filter, insert the line

Compile as described in the Compiling OmegaT from Source HowTo. Launch the newly compiled version. Check in Options > File Filters that the new filter is present. To check whether it works, you can place a TMX file in the /source folder of a project, or (more useful) perform a Text Search > Search files operation on TMX files.