+ * Check has a property basenameSeparator which allows setting separator in file names,
+ * default value is '_'.
+ *
+ * E.g.:
+ *
+ *
+ * messages_test.properties //separator is '_'
+ *
+ *
+ * app-dev.properties //separator is '-'
+ *
+ *
* @author Alexandra Bunge
* @author lkuehne
*/
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java
index f37ebb52e..d0dbb314b 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheckTest.java
@@ -61,4 +61,23 @@ public class TranslationCheckTest
// key2=y
// should not result in error message about key1 missing in the y bundle
+ @Test
+ public void testBaseNameSeparator() throws Exception
+ {
+ final DefaultConfiguration checkConfig = createCheckConfig(TranslationCheck.class);
+ checkConfig.addAttribute("basenameSeparator", "-");
+ final String[] expected = {
+ "0: Key 'only.english' missing.",
+ };
+ final File[] propertyFiles = new File[] {
+ new File(getPath("app-dev.properties")),
+ new File(getPath("app-stage.properties")),
+ };
+ verify(
+ createChecker(checkConfig),
+ propertyFiles,
+ getPath("app-dev.properties"),
+ expected);
+ }
+
}
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/app-dev.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/app-dev.properties
new file mode 100644
index 000000000..9a7ae0711
--- /dev/null
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/app-dev.properties
@@ -0,0 +1,12 @@
+# input file for TranslationCheck
+
+# a key that is available in all translations
+hello=Hallo
+
+# whitespace at end of key should be trimmed before comparing.
+# the german translation does not contain whitespace, no error should
+# be reported here
+cancel=Abbrechen
+
+# a key that is missing in german translation
+#only.english=only english
diff --git a/src/test/resources/com/puppycrawl/tools/checkstyle/app-stage.properties b/src/test/resources/com/puppycrawl/tools/checkstyle/app-stage.properties
new file mode 100644
index 000000000..a82290c28
--- /dev/null
+++ b/src/test/resources/com/puppycrawl/tools/checkstyle/app-stage.properties
@@ -0,0 +1,12 @@
+# input file for TranslationCheck
+
+# a key that is available in all translations
+hello=Hello
+
+# whitespace at end of key should be trimmed before comparing.
+# the german translation does not contain whitespace, no error should
+# be reported here
+cancel = Cancel
+
+# a key that is missing in german translation
+only.english=only english
diff --git a/src/xdocs/config_misc.xml b/src/xdocs/config_misc.xml
index d44177d9a..e682ad25d 100755
--- a/src/xdocs/config_misc.xml
+++ b/src/xdocs/config_misc.xml
@@ -215,16 +215,31 @@ messages.properties: Key 'ok' missing.