Translation Check - update changes due to new option, issue #149
This commit is contained in:
parent
284b505ace
commit
7e36b3cbd1
|
|
@ -52,6 +52,18 @@ import java.util.Map.Entry;
|
|||
* <pre>
|
||||
* <module name="Translation"/>
|
||||
* </pre>
|
||||
* Check has a property <b>basenameSeparator</b> which allows setting separator in file names,
|
||||
* default value is '_'.
|
||||
* <p>
|
||||
* E.g.:
|
||||
* </p>
|
||||
* <p>
|
||||
* messages_test.properties //separator is '_'
|
||||
* </p>
|
||||
* <p>
|
||||
* app-dev.properties //separator is '-'
|
||||
* </p>
|
||||
* <br>
|
||||
* @author Alexandra Bunge
|
||||
* @author lkuehne
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -215,16 +215,31 @@ messages.properties: Key 'ok' missing.
|
|||
<td><a href="property_types.html#stringSet">String Set</a></td>
|
||||
<td><code>properties</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>basenameSeparator</td>
|
||||
<td>Allows setting file names separator</td>
|
||||
<td><a href="property_types.html#string">String</a></td>
|
||||
<td><code>_</code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</subsection>
|
||||
|
||||
<subsection name="Example">
|
||||
<p>
|
||||
To configure the check:
|
||||
To configure the check for files with '_' name separator:
|
||||
</p>
|
||||
<source>
|
||||
<module name="Translation"/>
|
||||
</source>
|
||||
|
||||
<p>
|
||||
To configure the check for files with user-set name separator:
|
||||
</p>
|
||||
<source>
|
||||
<module name="Translation">
|
||||
<property name="basenameSeparator" value="STRING_LITERAL"/>
|
||||
</module>
|
||||
</source>
|
||||
</subsection>
|
||||
|
||||
<subsection name="Package">
|
||||
|
|
|
|||
Loading…
Reference in New Issue