added a key translation consistence test

This commit is contained in:
hneemann 2017-07-05 13:10:01 +02:00
parent ae614b6135
commit 5b27bb40a7
4 changed files with 68 additions and 0 deletions

View File

@ -75,6 +75,13 @@ public class Key<VALUE> {
return getName();
}
/**
* @return the language key
*/
public String getLangKey() {
return langKey;
}
/**
* A integer attribute.
* Stores additional combo box values

View File

@ -574,6 +574,7 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
<string name="key_Size">Größe</string>
<string name="key_Size_tt">Die Größe des Elements in der Schaltung.</string>
<string name="key_Language">Sprache</string>
<string name="key_Language_tt">Sprache der Oberfläche. Wird erst nach einem Neustart wirksam.</string>
<string name="key_NetName">Netzname</string>
<string name="key_NetName_tt">Alle Netze mit identischem Namen werden miteinander verbunden.</string>
<string name="key_InputSplitting">Eingangsaufteilung</string>
@ -610,13 +611,18 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
<string name="key_maxStepCount">Maximale Messpunktezahl</string>
<string name="key_maxStepCount_tt">Die maximale Anzahl an Messpunkten die gespeichert werden, bevor die ältesten Messungen verworfen werden.</string>
<string name="key_microStep">Zeige Einzelgatterschritte</string>
<string name="key_microStep_tt">Zeigt in der Grafik alle Einzelgatterschritte an.</string>
<string name="key_rotation">Rotation</string>
<string name="key_rotation_tt">Legt die Ausrichtung des Elementes in der Schaltung fest.</string>
<string name="key_runRealTime">Echtzeittakt starten</string>
<string name="key_runRealTime_tt">Wenn eingeschaltet, wird beim Start der Schaltung der Echtzeittakt gestartet.</string>
<string name="key_showDataGraph">Zeige Messwertegraph</string>
<string name="key_showDataGraph_tt">Beim Start der Simulation wird ein Graph mit den Messwerten angezeigt.</string>
<string name="key_showDataGraphMicro">Zeige Messwertgraph im Gatterschrittmodus</string>
<string name="key_showDataGraphMicro_tt">Beim Start der Simulation wird ein Graph mit den Messwerten im Gatterschrittmodus
angezeigt. Dabei werden alle Gatterwechsel angezeigt.</string>
<string name="key_showDataTable">Zeige Messwertetabelle</string>
<string name="key_showDataTable_tt">Beim Start der Simulation wird eine Tabelle mit den Messwerten angezeigt.</string>
<string name="key_showList">Zeige Listing an, wenn verfügbar</string>
<string name="key_termHeight">Zeilen</string>
<string name="key_termHeight_tt">Die Anzahl der anzuzeigenden Zeilen.</string>

View File

@ -564,6 +564,7 @@ The names of the variables may not be unique.</string>
<string name="key_Size">Size</string>
<string name="key_Size_tt">The size of the component in the circuit.</string>
<string name="key_Language">Language</string>
<string name="key_Language_tt">Language of the GUI. Will only take effect after a restart.</string>
<string name="key_NetName">Net name</string>
<string name="key_NetName_tt">All nets with identical name are connected together.</string>
<string name="key_InputSplitting">Input Splitting</string>
@ -600,13 +601,18 @@ The names of the variables may not be unique.</string>
<string name="key_maxStepCount">Max number of steps to show</string>
<string name="key_maxStepCount_tt">The maximal number of values stored. If the maximum number is reached, the oldest values are discarded.</string>
<string name="key_microStep">Show single gate steps</string>
<string name="key_microStep_tt">Shows all single step steps in the graphic.</string>
<string name="key_rotation">Rotation</string>
<string name="key_rotation_tt">The orientation of the Element in the circuit.</string>
<string name="key_runRealTime">Start real time clock</string>
<string name="key_runRealTime_tt">If enabled the runtime clock is started when the circuit is started</string>
<string name="key_showDataGraph">Show measurement graph</string>
<string name="key_showDataGraph_tt">When the simulation is started, a graph with the measured values is shown.</string>
<string name="key_showDataGraphMicro">Show measurement graph in single gate step mode</string>
<string name="key_showDataGraphMicro_tt">When the simulation is started, a graph with the measured values in the
gate step mode is shown. All gate changes are included in the graph.</string>
<string name="key_showDataTable">Show measurement values</string>
<string name="key_showDataTable_tt">When the simulation is started, a table with the measured values is shown.</string>
<string name="key_showList">Show list file if available</string>
<string name="key_termHeight">Lines</string>
<string name="key_termHeight_tt">The number of lines to show.</string>

View File

@ -0,0 +1,49 @@
package de.neemann.digital.lang;
import de.neemann.digital.core.NodeException;
import de.neemann.digital.core.basic.FanIn;
import de.neemann.digital.core.element.*;
import de.neemann.digital.core.memory.LookUpTable;
import de.neemann.digital.core.wiring.Decoder;
import de.neemann.digital.core.wiring.Demultiplexer;
import de.neemann.digital.core.wiring.Splitter;
import de.neemann.digital.draw.elements.PinException;
import de.neemann.digital.draw.graphics.GraphicSVG;
import de.neemann.digital.draw.library.ElementLibrary;
import junit.framework.TestCase;
import java.lang.reflect.Field;
/**
* Created by hneemann on 19.11.16.
*/
public class TestKeyConsistence extends TestCase {
/**
* Checks if key descriptions are complete
*
* @throws NodeException
* @throws PinException
* @throws IllegalAccessException
*/
public void testConsistence() throws NodeException, PinException, IllegalAccessException {
for (Field f : Keys.class.getDeclaredFields()) {
Key key = ((Key) f.get(null));
checkKey(key.getLangKey());
checkKey(key.getLangKey() + "_tt");
}
}
private void checkKey(String key) {
String str = Lang.getNull(key);
if (str == null)
missing(key);
}
private void missing(String key) {
final String xml = GraphicSVG.escapeXML(key);
System.out.println("<string name=\"" + xml + "\">" + xml + "</string>");
fail("key '" + key + "' is missing!");
}
}