Skip to content

Commit

Permalink
Refine TODO (#11820)
Browse files Browse the repository at this point in the history
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Co-authored-by: Ruslan <ruslanpopov1512@gmail.com>
Co-authored-by: Subhramit Basu Bhowmick <74734844+subhramit@users.noreply.github.com>
  • Loading branch information
5 people committed Sep 23, 2024
1 parent 6aadcb0 commit 61f7c1e
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,22 @@ void findObsoleteLocalizationKeys() throws IOException {

@Test
void localizationParameterMustIncludeAString() throws IOException {
// Must start or end with "
// Localization.lang("test"), Localization.lang("test" + var), Localization.lang(var + "test")
// TODO: Localization.lang(var1 + "test" + var2) not covered
// Localization.lang("Problem downloading from %1", address)
// Must start with "
// - Localization.lang("test")
// - Localization.lang("test %1", var)
// - Localization.lang("Problem downloading from %1", address)
// - Localization.lang("test %1 %2", var1, var2)
Set<LocalizationEntry> keys = LocalizationParser.findLocalizationParametersStringsInJavaFiles(LocalizationBundleForTest.LANG);
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());
// TODO: Forbidden Localization.lang("test" + var2) not covered by the test
// In case this kind of code is found, an error should be reported
// JabRef's infrastructure only supports Localization.lang("Some Message"); and not something else.
assertTrue(e.getKey().startsWith("\""), "Illegal localization parameter found. Must include a String with potential concatenation or replacement parameters. Illegal parameter: Localization.lang(" + e.getKey());
}

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("\""), "Illegal localization parameter found. Must include a String with potential concatenation or replacement parameters. Illegal parameter: Localization.lang(" + e.getKey());
}
}

Expand Down

0 comments on commit 61f7c1e

Please sign in to comment.