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

finish ToDo in localizationParameterMustIncludeAString #11793

Closed
wants to merge 1 commit into from

Conversation

leaf-soba
Copy link
Contributor

  1. add StringUtils.countMatches(e.getKey(), """) == 2 to cover Localization.lang(var1 + "test" + var2) case
  2. add link and some information to comment

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

1. add StringUtils.countMatches(e.getKey(), "\"") == 2 to cover Localization.lang(var1 + "test" + var2) case
2. add link and some information to comment
koppor

This comment was marked as outdated.

}

keys = LocalizationParser.findLocalizationParametersStringsInJavaFiles(LocalizationBundleForTest.MENU);
for (LocalizationEntry e : keys) {
assertTrue(e.getKey().startsWith("\"") || e.getKey().endsWith("\""), "Illegal localization parameter found. Must include a String with potential concatenation or replacement parameters. Illegal parameter: Localization.lang(" + e.getKey());
assertTrue(e.getKey().startsWith("\"") || e.getKey().endsWith("\"") || StringUtils.countMatches(e.getKey(), "\"") == 2, "Illegal localization parameter found. Must include a String with potential concatenation or replacement parameters. Illegal parameter: Localization.lang(" + e.getKey());
Copy link
Member

Choose a reason for hiding this comment

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

One day later, I have a more clear mind.

We have

Localization.lang("Added group \"%0\".", group.getName())

Localiatzion:

Added group "%0".

It has two ". This is OK.

The updated code of you checks for two of them. It should match. It does not.

I think, more debugging and thinking is required here.

Maybe, a test for the test needs to be developed?

It is OK for a coding excercise, but not really required for JabRef. We have many other user-facing issues. We should work on these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One day later, I have a more clear mind.

We have

Localization.lang("Added group \"%0\".", group.getName())

Localiatzion:

Added group "%0".

It has two ". This is OK.

The updated code of you checks for two of them. It should match. It does not.

I think, more debugging and thinking is required here.

Maybe, a test for the test needs to be developed?

It is OK for a coding excercise, but not really required for JabRef. We have many other user-facing issues. We should work on these.

OK, I'll try to find a proper user-facing issue to solve from tomorrow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Localization.lang("Added group "%0".", group.getName())

this case can be covered by e.getKey().startsWith("\""), so that is why my code can pass the unit test phase in CI/CD workflow or local test run.

Copy link
Member

Choose a reason for hiding this comment

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

The || in the condition feels wrong.

Localization.lang(var1 + "test" + var2)

Matches this condition, but is forbidden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The || in the condition feels wrong.

Localization.lang(var1 + "test" + var2)

Matches this condition, but is forbidden.

the original ToDo is TODO: Localization.lang(var1 + "test" + var2) not covered, I thought it means Localization.lang(var1 + "test" + var2) is not forbidden.

Then just delete the ToDo in comment like option 2 in #11784 or I just close this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey, sorry to have kept you waiting. We put through a refinement at #11820 and thus decided on closing this one.

Thanks for taking this up!

@koppor koppor mentioned this pull request Sep 23, 2024
6 tasks
@leaf-soba leaf-soba deleted the close-issue-11784 branch September 26, 2024 06:51
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.

Finish ToDo in localizationParameterMustIncludeAString
3 participants