From f0c0a023a0622d842b7a4b78dff73aa0be4c75a0 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Mon, 23 Sep 2024 22:28:02 +0200 Subject: [PATCH] Refine TODO Co-authored-by: Christoph Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> Co-authored-by: Ruslan Co-authored-by: Subhramit Basu Bhowmick <74734844+subhramit@users.noreply.github.com> --- .../logic/l10n/LocalizationConsistencyTest.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java b/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java index 718a3f5afbc..e88a90f5c5c 100644 --- a/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java +++ b/src/test/java/org/jabref/logic/l10n/LocalizationConsistencyTest.java @@ -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 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()); } }