mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-27 06:51:37 -04:00
added consistence check for enum language keys
This commit is contained in:
parent
b3a3a25438
commit
7c46da19e8
@ -68,7 +68,7 @@ public class Key<VALUE> {
|
||||
* @return the keys description
|
||||
*/
|
||||
public String getDescription() {
|
||||
String d=Lang.getNull(langKey + "_tt");
|
||||
String d = Lang.getNull(langKey + "_tt");
|
||||
if (d != null)
|
||||
return d;
|
||||
else
|
||||
@ -162,7 +162,17 @@ public class Key<VALUE> {
|
||||
|
||||
names = new String[values.length];
|
||||
for (int i = 0; i < values.length; i++)
|
||||
names[i] = Lang.get("key_" + key.replace(" ", "") + "_" + values[i].name());
|
||||
names[i] = Lang.get(getLangKey(values[i]));
|
||||
}
|
||||
|
||||
/**
|
||||
* creates the language key for the enum values
|
||||
*
|
||||
* @param value the value
|
||||
* @return the language key
|
||||
*/
|
||||
public String getLangKey(E value) {
|
||||
return getLangKey() + "_" + value.name();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,6 +31,12 @@ public class TestKeyConsistence extends TestCase {
|
||||
Key key = ((Key) f.get(null));
|
||||
checkKey(key.getLangKey());
|
||||
checkKey(key.getLangKey() + "_tt");
|
||||
|
||||
if (key instanceof Key.KeyEnum) {
|
||||
Key.KeyEnum ke = (Key.KeyEnum) key;
|
||||
for (Enum v : ke.getValues())
|
||||
checkKey(ke.getLangKey(v));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user