improved the language test cases

This commit is contained in:
hneemann 2019-02-03 10:32:22 +01:00
parent 81babefe90
commit a24ee74326
3 changed files with 32 additions and 11 deletions

View File

@ -11,10 +11,10 @@ Digital is a easy-to-use digital logic designer and circuit simulator designed f
## Installation ##
There is no installation necessary, just unpack the *Digital.zip* file, which is
There is no installation required, just unpack the *Digital.zip* file, which is
available for [download](https://github.com/hneemann/Digital/releases/latest).
On Windows machines the EXE file can be executed, on Linux and MacOS the
JAR file can be started directly.
On Windows machines the EXE file can be executed, on Linux start the shell script
and on MacOS the JAR file can be started directly.
A [Java Runtime Environment](https://www.java.com/) (at least JRE 8) is required
to run Digital.
@ -235,9 +235,9 @@ If you want to build Digital from the source code:
## Credits ##
* The verilog code generator and almost all the necessary verilog templates where implemented
by Ivan de Jesus Deras Tabora, a faculty member at Universidad Tecnológica Centroamericana in Honduras.
* The Portuguese translation was provided by Theldo Cruz Franqueira, a faculty member at
Pontifícia Universidade Católica de Minas Gerais in Brazil.
by Ivan de Jesus Deras Tabora; Universidad Tecnológica Centroamericana; Honduras.
* The Portuguese translation was provided by Theldo Cruz Franqueira;
Pontifícia Universidade Católica de Minas Gerais; Brazil.
## Additional Screenshots

View File

@ -11,7 +11,7 @@ The file "lang_xx_ref.xml" is important because it helps me
to keep track of future changes to the language files.
If you also want to translate the static part of the documentation,
you have to translate one of the files "static_xx.xml" from the
you have to translate the file "static_en.xml" from the
folder "src/test/Resources/Docu".
You can test the translation by simply putting the files into
@ -20,6 +20,15 @@ the Digital.jar file. It's not necessary to rebuild the jar.
If you are satisfied with the translation, please send me the
translated version AND the file "lang_xx_ref.xml" you used for the
translation!
If keys are added to or changed in the future, the keys must first
be copied unchanged to the reference file. They can then be added
or updated in the corresponding language file. The idea is to
always keep the reference file synchronous with the language file.
In this way it can be recognized whether a translation needs to
be revised or not: This is always the case if a text from the
English language file no longer matches the text in the reference
file.
-->
<languages>
<lang name="en">English</lang>

View File

@ -105,7 +105,7 @@ public class TestLang extends TestCase {
obsolete.add(k);
String val = langResources.get(k);
assertFalse(l+"; "+k+"; not trimmed: >" + val + "<", !val.contains("\n") && !val.equals(val.trim()));
assertFalse(l + "; " + k + "; not trimmed: >" + val + "<", !val.contains("\n") && !val.equals(val.trim()));
}
if (!obsolete.isEmpty()) {
System.out.println("Obsolete language keys for: " + l);
@ -116,12 +116,12 @@ public class TestLang extends TestCase {
}
ArrayList<String> modified = new ArrayList<>();
de.neemann.gui.language.Resources origResource =
de.neemann.gui.language.Resources refResource =
new de.neemann.gui.language.Resources(
getClass().getClassLoader().getResourceAsStream("lang/lang_" + l.getName() + "_ref.xml"));
for (String k : master.getKeys()) {
String m = master.get(k);
String o = origResource.get(k);
String o = refResource.get(k);
if (m != null && o != null && !m.equals(o))
modified.add(k);
}
@ -131,11 +131,23 @@ public class TestLang extends TestCase {
missing.sort(String::compareTo);
for (String k : modified) {
System.out.println(" key: " + k);
System.out.println(" old: " + origResource.get(k));
System.out.println(" old: " + refResource.get(k));
System.out.println(" new: " + master.get(k));
System.out.println(" old: " + langResources.get(k));
}
}
ArrayList<String> missingInRef = new ArrayList<>();
for (String k : langKeys)
if (refResource.get(k) == null)
missingInRef.add(k);
if (!missingInRef.isEmpty()) {
System.out.println("Missing keys in the reference file for: " + l);
for (String k : missingInRef) {
System.out.println(" " + k);
}
}
}
public static File getSourceFiles() {