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

Translate checkArgument messages #4978

Closed

Conversation

Jakub-CZ
Copy link
Contributor

Fixes #2619

Messages in some checkArgument calls are replaced with translatable strings.

There are many more instances, incl. ones in calls of similar functions (notEmpty, notBlank, notNull). However, most seem to be unreachable by the users; the GUI prevents the conditions from ever happening. Many messages are not even intended to be seen by users; they include things like private method names and local variable names.

In fact, I wasn't able to reproduce even some of those few messages that are updated by this PR.

@Jakub-CZ
Copy link
Contributor Author

Jakub-CZ commented Dec 19, 2020

Hi, this is my 2nd PR, just a little less trivial than my first one. I picked it up mainly to learn a bit more about the internals.

As I was making changes I realized that this rabbit hole goes deeper than I originally anticipated. On one hand, translating all checkArgument messages could introduce dozens and dozens of new strings, lots of extra work for the translators. On the other hand, most messages seem to be practically impossible to reach by regular users.

Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

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

In general I don't think it's worth moving these strings to resources. Some do have value as they're useful for users, but it's mostly meant as a way to trouble shoot issues together with users, or as a safety check that should never happen but just a good to have.

Adding more strings to resources adds more work for translators for very little benefit. I can still see the benefit of some of these strings so would ack if @ManfredKarrer agrees, as this is a change to core DAO code which can't be merged without his ack as per project guidelines.

// buyerAmount can be 0
if (buyerAmount.isPositive()) {
Preconditions.checkArgument(Restrictions.isAboveDust(buyerAmount),
"The buyerAmount is too low (dust limit).");
Res.get("validation.amountBelowDust.shortVar", "buyerAmount"));
Copy link
Member

Choose a reason for hiding this comment

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

This kind of argument defeats the aim of making the strings translatable. In this case it's better to just make two strings, or reuse validation.amountBelowDust.short

Copy link
Member

@ManfredKarrer ManfredKarrer left a comment

Choose a reason for hiding this comment

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

NACK

I don't think we should start translating those type of strings. They are mostly in place for catching edge case bugs and for debugging. In case such an error occurs the user can send a screenshot of the error popup to developers. It is not intended as error messages the user can deal with, so translation does not add value here.
It would also add more effort in dev process and for translators.

I appreciate your intentions and effort but I fear that PR is going in the wrong direction. Best to search the GH issue list for "best first issues" or the like. There are plenty of issues and TODOs open specially in the UI side which would add lot of value to Bisq.

@Jakub-CZ
Copy link
Contributor Author

Jakub-CZ commented Jan 2, 2021

Understood. I did pick an issue tagged with "good first issue", sadly it seems that the issue wasn't very well defined.

I agree that most instances of checkArgument are used for those "should never happen" kind of checks. The rest should rely on custom Exceptions rather than these generic IllegalArgumentExceptions.

@Jakub-CZ Jakub-CZ closed this Jan 2, 2021
@ManfredKarrer
Copy link
Member

@Jakub-CZ Yes, not your fault but Bisq's lack of maintaining the GH issues better.... too much work for too few devs ;-)

@ripcurlx
Copy link
Member

ripcurlx commented Jan 8, 2021

@Jakub-CZ Sorry about that! This was marked incorrectly as a good first issue by a GitHub issue maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate checkArgument messages
4 participants