Skip to content

Finish ToDo in localizationParameterMustIncludeAString #11784

@leaf-soba

Description

@leaf-soba

Is your suggestion for improvement related to a problem? Please describe.

  1. I saw a ToDo in this unit test, said "TODO: Localization.lang(var1 + "test" + var2) not covered", and I want to finish it.
  2. I checked all strings in Localization.lang parameter in repo now, only got string begin with ".
  3. 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?
  4. 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.
  1. 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());
  1. 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

  2. fix the code by delete e.getKey().endsWith("\"")

assertTrue(e.getKey().startsWith("\""), "Illegal localization parameter found. Must include a String with potential concatenation or replacement parameters. Illegal parameter: Localization.lang(" + e.getKey());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions