New provider for crash-protected project memory

Actually if a change is done in a segment in OmegaT, it is only in memory and if OmegaT is closed uncorrectly, changes are lost unless you have explicitly saved the project.

Some people would prefer that project save occurs on every segment change, but since save implies conversion to TMX (project_save.tmx) this could significantly decrease performances.

To solve the problem I introduce a new project memory plugin. It is integrated in the core, to activate it, simply create a file named project_save.properties with only the following line:

class=org.omegat.core.matching.external.NoDelaySaver

This is a standard properties file, you can add comments if you want. Actually only the property "class" is defined for this plugin (other plugins have more properties and we may add other properties for this one later)

Once the plugin is activated, each time you modify a segment it is also sent to a file project_save.tmp; contrarily to TMX, this file is not an XML, it is a kind of Tab-separated values file which grows without the need to be fully saved each time. Once you save the project, this file disappears. But if on the contrary, OmegaT is closed without saving (either because you asked for it or because it was broken accidentally) then the file is here, and next time you open OmegaT with the same project, all segments which are in this file will be re-imported inside the project.

Thanks to that you should never loose a segment unless you want it: you can edit the file in a standard text editor, add or remove segments, or even delete the file completely if you realize that it contains too much errors. Simply, do it before opening the project in OmegaT: once you do it, segments are again in memory, saved in project_save.tmx and the file disappears.

This feature is to be experimented. It is integrated in patches for Cyclotis, both patches and binary version.

Add new comment