Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGS#1238] fix: check cache before asking engine when visit translat… #884

Conversation

miurahr
Copy link
Member

@miurahr miurahr commented Dec 24, 2023

…ed segment

Pull request type

  • Bug fix -> [bug]
  • Feature enhancement -> [enhancement]

Which ticket is resolved?

What does this PR change?

  • Refactor MahcineTranlationTextArea class
  • Always check cache then go to transalate function
  • Update contributors manual
  • Add dummy fake connector for MT feature test

Other information

Copy link

❌ Run Gradle test failed:

@brandelune
Copy link
Contributor

I don't use MT from OmegaT so I would not know how to test this.


There are two convenience class for plugins. You are recommended to use `org.omegat.core.
machinetranslators.BaseCachedTranslate`. It implements many necessary things, and you can concentrate into a logic to
access your MT engine API. There are only three methods you should override.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should express about how to handle credentials to access API. Also we should describe how to implement a preferences dialog to ask credential information and how to store the credentials in a persistent storage.

- [NICT TexTra](https://codeberg.org/miurahr/omegat-textra-plugin/releases)
- [Tencent translation](https://github.com/yoyicue/omegat-tencent-plugin)

## Getting started the project
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review comments tell us a suggestion that developers may want to know a way to write unit tests, to run integration test, and a way to run implemented features without learning things which he should know.
We can explain about WireMock and give a reference URL when developers want to learn it for unit tests.
We can also explain a parser test example which is mandatory for unit test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review comments tell us a suggestion that developers may want to know a way to write unit tests, to run integration test, and a way to run implemented features without learning things which he should know.

If you tag me for review and you don't tell me explicitly what I'm supposed to do and what I'm supposed to expect, I'm not sure my review will be very relevant.

Also, there is no such thing that I "should know". There are things that you know, things that I know, and things that I can learn, but I can't guess what I have to learn if it is not explicitly stated, and then it depends on my general availability.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is challenging for me to express a fact and ideas correctly. I have an idea to provide a way to test a MT feature of OmegaT without knowing actual MT services, and want to write a document about it.
I will update a topic branch with a feature and description how to use it. This will allow developers to see a behavior without learning external services/products other than OmegaT.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls. see an update.

return translator.getCachedTranslation(source, target, src);
}
String cached = translator.getCachedTranslation(source, target, src);
if (cached != null || !Preferences.isPreferenceDefault(Preferences.MT_AUTO_FETCH, false)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can check code coverage whether the all the conditions are covered in unit tests.

@miurahr
Copy link
Member Author

miurahr commented Jan 8, 2024

You can check a new section of a developer manual.

@brandelune
Copy link
Contributor

You can check a new section of a developer manual.

I guess you mean "You can check the new section of the developer manual" ?
Could you also provide the link?

@miurahr
Copy link
Member Author

miurahr commented Jan 9, 2024

You can check a new section of a developer manual.

I guess you mean "You can check the new section of the developer manual" ? Could you also provide the link?

https://github.com/omegat-org/omegat/pull/884/files#diff-b03ac6a38d1c155542e79e5eecf65aa9d957fe96d4d55f848ed9be8b4d70f307

You can find docs_devel/docs/12.HowToMakeMTConnector.md and docs_devel/docs/35.SpecificFeatureTests.md

@miurahr
Copy link
Member Author

miurahr commented Feb 1, 2024

@brandelune any progress?

@brandelune
Copy link
Contributor

@brandelune any progress?

No sorry. I think I have checked the manual and reported on that, but I have not tested the branch.
I won't be able to test it before at least a week. So unless other reviewers have issues, I guess that's fine with me.

@miurahr miurahr merged commit c0b2a3f into master Feb 10, 2024
9 checks passed
@miurahr miurahr deleted the topic/miurahr/machinetranslators/caller-check-cached-entry-when-translated branch February 10, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants