01: /*
02: * ResourceMgrTest.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.resource;
13:
14: import java.util.Enumeration;
15: import java.util.HashSet;
16: import java.util.Locale;
17: import java.util.ResourceBundle;
18: import junit.framework.TestCase;
19:
20: /**
21: *
22: * @author support@sql-workbench.net
23: */
24: public class ResourceMgrTest extends TestCase {
25:
26: public ResourceMgrTest(String testName) {
27: super (testName);
28: }
29:
30: /**
31: * Make sure all keys are translated.
32: */
33: public void testTranslation() {
34: Locale en = new Locale("en");
35: Locale de = new Locale("de");
36:
37: ResourceBundle enBundle = ResourceMgr.getResourceBundle(en);
38: ResourceBundle deBundle = ResourceMgr.getResourceBundle(de);
39: assertNotNull(enBundle);
40: assertNotNull(deBundle);
41:
42: // HashSet<String> wrongKeys = new HashSet<String>();
43: // HashSet<String> ignoreKeys = new HashSet<String>();
44: // ignoreKeys.add("TxtBuildDate");
45: // ignoreKeys.add("TxtBuildNumber");
46: // ignoreKeys.add("TxtCopyright");
47: //
48: // Enumeration<String> enKeys = enBundle.getKeys();
49: // while (enKeys.hasMoreElements())
50: // {
51: // String key = enKeys.nextElement();
52: // if (ignoreKeys.contains(key)) continue;
53: // String enValue = enBundle.getString(key);
54: // String deValue = deBundle.getString(key);
55: // if (enValue.equals(deValue))
56: // {
57: // wrongKeys.add(key + ", en=" + enValue + ", de=" + deValue);
58: // }
59: // }
60: // if (wrongKeys.size() > 0)
61: // {
62: // System.out.println("Keys not translated!");
63: // for (String key : wrongKeys)
64: // {
65: // System.out.println(key);
66: // }
67: // fail("Not all translation keys translated!");
68: // }
69: }
70:
71: }
|