Révision 1303

tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/NormalizeKeys.java (revision 1303)
1 1
package org.txm.rcp.translate.devtools;
2 2

  
3
import java.io.File;
3 4
import java.io.FileNotFoundException;
4 5
import java.io.IOException;
5 6
import java.io.UnsupportedEncodingException;
......
7 8
import java.util.HashMap;
8 9

  
9 10
import org.txm.rcp.translate.i18n.PluginMessagesManager;
10
import org.txm.rcp.translate.i18n.WorkspaceMessagesManager;
11
import org.txm.utils.BiHashMap;
12 11

  
13 12
/**
14 13
 * Normalizes the keys using the words of the message sentence.
......
260 259
		//			e.printStackTrace();
261 260
		//		}
262 261

  
263
		NormalizeKeys keysNormalizer = new NormalizeKeys(false);
262
		NormalizeKeys keysNormalizer = new NormalizeKeys(true);
264 263

  
265
		WorkspaceMessagesManager wmm = new WorkspaceMessagesManager(false);
266
		int total = 0;
267
		for (PluginMessagesManager pm : wmm.getPluginMessages().values()) {
268
			total += keysNormalizer.normalize(pm);
264
//		WorkspaceMessagesManager wmm = new WorkspaceMessagesManager(false);
265
//		int total = 0;
266
//		for (PluginMessagesManager pm : wmm.getPluginMessages().values()) {
267
//			total += keysNormalizer.normalize(pm);
268
//			
269
//			pm.saveChanges(true); // mode homme
270
//			//pm.saveChanges(false);
271
//		}
272
//		
273
//		if (total > 0) {
274
//			wmm.saveKeyModificationsInSources();
275
//			System.out.println("Done: "+total+" change.");
276
//		} else {
277
//			System.out.println("Done: no change.");
278
//		}		
279

  
280
		//File projectFile = new File(new File(System.getProperty("user.dir")).getParentFile().getAbsolutePath() + "/org.txm.core");
281
		File projectFile = new File(new File(System.getProperty("user.dir")).getParentFile().getAbsolutePath() + "/org.txm.ahc.core");
282
		PluginMessagesManager pmManager = new PluginMessagesManager(projectFile, true);
283
		keysNormalizer.normalize(pmManager);
269 284
			
270
			pm.saveChanges(true); // mode homme
271
			//pm.saveChanges(false);
272
		}
285
		//pm.saveChanges(true); // mode homme
286
		//pmManager.saveChanges(false);
287

  
273 288
		
274
		if (total > 0) {
275
			wmm.saveKeyModificationsInSources();
276
			System.out.println("Done: "+total+" change.");
277
		} else {
278
			System.out.println("Done: no change.");
279
		}
280 289
	}
281 290
}

Formats disponibles : Unified diff