Révision 1293
tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/MergeDuplicatedStringsInAPlugin.java (revision 1293) | ||
---|---|---|
27 | 27 |
this.debug = debug; |
28 | 28 |
} |
29 | 29 |
|
30 |
public void merge(PluginMessagesManager pm) {
|
|
30 |
public int merge(PluginMessagesManager pm) {
|
|
31 | 31 |
HashMap<String, String> defaults = pm.getMessagesForDefaultLang(); |
32 | 32 |
TreeMap<String, String> value2Key = new TreeMap<String, String>(); |
33 | 33 |
|
... | ... | |
43 | 43 |
merges.put(key, new TreeSet<String>()); |
44 | 44 |
} |
45 | 45 |
} |
46 |
|
|
47 |
for (String key : keys) { |
|
48 |
if (merges.get(key) != null && merges.get(key).size() == 0) { |
|
49 |
merges.remove(key); |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
53 |
if (merges.size() > 0) { |
|
54 |
System.out.println(" Done: "+pm.getMessageFullName()+" "+merges.size()+" merges: "+merges); |
|
55 |
} else { |
|
56 |
//System.out.println(" Done: no merge"); |
|
57 |
} |
|
58 |
|
|
59 |
return merges.size(); |
|
46 | 60 |
} |
47 | 61 |
|
48 | 62 |
/** |
49 |
* |
|
50 | 63 |
* @param args |
51 | 64 |
* @throws IOException |
52 | 65 |
* @throws FileNotFoundException |
... | ... | |
57 | 70 |
MergeDuplicatedStringsInAPlugin merger = new MergeDuplicatedStringsInAPlugin(false); |
58 | 71 |
|
59 | 72 |
WorkspaceMessagesManager wmm = new WorkspaceMessagesManager(); |
73 |
int total = 0; |
|
60 | 74 |
for (PluginMessagesManager pm : wmm.getPluginMessages().values()) { |
61 |
merger.merge(pm); |
|
75 |
total += merger.merge(pm);
|
|
62 | 76 |
|
63 | 77 |
//pm.saveChanges(true); |
64 | 78 |
} |
65 | 79 |
|
66 | 80 |
//wmm.saveKeyModificationsInSources(); |
81 |
|
|
82 |
if (total > 0) { |
|
83 |
System.out.println("Done: "+total); |
|
84 |
} else { |
|
85 |
System.out.println("Done: no merge"); |
|
86 |
} |
|
67 | 87 |
} |
68 | 88 |
} |
Formats disponibles : Unified diff