transducens / Forecat-OmegaT

Plugin that adds the functionality of Forecat (https://github.com/jaspock/forecat) to OmegaT.
GNU General Public License v3.0
8 stars 0 forks source link

Old suggestions for segments where MT results weren't fetched #2

Closed kosivantsov closed 6 years ago

kosivantsov commented 6 years ago

In OmegaT 4.1.x MT suggestions can be fetched manually (Options -> Machine Translate -> Manually Fetch Translations). This options seems to apply to Forecat too. Nevertheless, for the segments where MT was not run Forecat suggestions still pop up, but they seem to be based on the previous segment for which MT results were fetched.

kosivantsov commented 6 years ago

It would be great if Forecat cached the results similar to the way other MT "plugins" do, so whenever the segment is reopen (within the same session), the results wouldn't need to be fetched again.

dtr5 commented 6 years ago

I have looked at this, and I think I cannot easily fix this.

Whenever OmegaT fetches translations, it makes a call to the "translate" method. This method is the one that makes Forecat update its suggestions: hence, if it is not called, Forecat is oblivious to the fact you changed segments.

I will get in touch with OmegaTdev and try to sort this out in a nice way. Otherwise, I will have to resort to using reflection to force OmegaT to inform Forecat that a segment has changed; this means the plugin will be tightly coupled to the current implementation of OmegaT, and any minor change in the future will break the plugin.

On the other hand, OmegaT does not cache the translations, but it is "daisy-chained" to the "getTranslation" method of the rest of MT plugins (or inbuilts; there is no difference code-wise). While most MT implementations look like they implement the cache inside translate too, this is not guaranteed; 33bd69142916505d88d2a720a5795f5d387b092b addresses it.

eltorre commented 6 years ago

So, I found an easy way to fix this issue.

After b8df9929a4ee93df5ed27defe377c268435e7fc4, only the last segment "translated" has suggestions.

Still, I think the proper answer is to have a local cache, so I do not rely on OmegaT firing the "translate" event to offer suggestions. I have opened #6 for this.