You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your suggestion for improvement related to a problem? Please describe.
I saw a ToDo in this unit test, said "TODO: Localization.lang(var1 + "test" + var2) not covered", and I want to finish it.
I checked all strings in Localization.lang parameter in repo now, only got string begin with ".
It means we don't have case Localization.lang(var + "test") or Localization.lang(var1 + "test" + var2) in repo, do I need to cover them when I finish the ToDo?
I think only when developers need string concatenation in Localization.lang would use Localization.lang(var + "test") and Localization.lang(var1 + "test" + var2)
Describe the solution you'd like
one of these solution should work, not all of them.
finish the ToDo, to cover future string concatenation case in Localization.lang by add StringUtils.countMatches(e.getKey(), "\"") >= 2
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());
assertTrue(e.getKey().startsWith("\""), "Illegal localization parameter found. Must include a String with potential concatenation or replacement parameters. Illegal parameter: Localization.lang(" + e.getKey());
The text was updated successfully, but these errors were encountered:
1. finish the ToDo, to cover future string concatenation case in `Localization.lang` by add `StringUtils.countMatches(e.getKey(), "\"") >= 2`
It needs to be ==.
We just support Localization.lang("fixed-string");.
That should be checked. Nothing more.
StringUtils.countMatches(e.getKey() is a great idea 👍. Simple and efficient.
Note that I tried to use Java Parser, but I failed. #8050 (comment)
The other solution for localization is to use Kilt.
However, this does NOT solve the issue of string concatenation. We also do not want that concatenation, because we want to have the strings literally in the source code. Paramters by %0 etc.
We also do NOT want to switch to the syntax of MessageFormat
Is your suggestion for improvement related to a problem? Please describe.
Localization.lang
parameter in repo now, only got string begin with ".Localization.lang(var + "test")
orLocalization.lang(var1 + "test" + var2)
in repo, do I need to cover them when I finish the ToDo?Localization.lang
would useLocalization.lang(var + "test")
andLocalization.lang(var1 + "test" + var2)
Describe the solution you'd like
Localization.lang
by addStringUtils.countMatches(e.getKey(), "\"") >= 2
just fix comment without code change, such as delete the ToDo comment and add the link to https://devdocs.jabref.org/code-howtos/localization.html
fix the code by delete
e.getKey().endsWith("\"")
The text was updated successfully, but these errors were encountered: