Révision 1564
| tmp/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java (revision 1564) | ||
|---|---|---|
| 41 | 41 |
/** |
| 42 | 42 |
* Files encoding. |
| 43 | 43 |
*/ |
| 44 |
public static String ENCODING = "UTF-8";
|
|
| 44 |
public static String UTF8 = "UTF-8";
|
|
| 45 | 45 |
|
| 46 | 46 |
public final static String FILE_SEPARATOR = System.getProperty("file.separator");
|
| 47 | 47 |
|
| ... | ... | |
| 212 | 212 |
HashMap<String, String> hash = langs.get(propFile); |
| 213 | 213 |
|
| 214 | 214 |
Properties props1 = new Properties(); |
| 215 |
props1.load(IOUtils.getReader(propFile, ENCODING));
|
|
| 215 |
props1.load(IOUtils.getReader(propFile, UTF8));
|
|
| 216 | 216 |
for (Object k : props1.keySet()) {
|
| 217 | 217 |
hash.put(k.toString(), props1.get(k).toString()); |
| 218 | 218 |
} |
| 219 | 219 |
} |
| 220 | 220 |
|
| 221 |
BufferedReader reader2 = new BufferedReader(new InputStreamReader(new FileInputStream(javaMessageFile), ENCODING));
|
|
| 221 |
BufferedReader reader2 = new BufferedReader(new InputStreamReader(new FileInputStream(javaMessageFile), UTF8));
|
|
| 222 | 222 |
String line2 = reader2.readLine(); |
| 223 | 223 |
while (line2 != null) {
|
| 224 | 224 |
line2 = line2.trim(); |
| ... | ... | |
| 412 | 412 |
// New version using REGEX |
| 413 | 413 |
for (File file : this.srcFiles) {
|
| 414 | 414 |
if (!file.exists()) continue; |
| 415 |
String lines = IOUtils.getText(file, PluginMessagesManager.ENCODING);
|
|
| 415 |
String lines = IOUtils.getText(file, PluginMessagesManager.UTF8);
|
|
| 416 | 416 |
|
| 417 | 417 |
Matcher m = WorkspaceMessagesManager.KEY_REGEX.matcher(lines); |
| 418 | 418 |
//Matcher m = this.keysGlobalREGEX.matcher(lines); |
| ... | ... | |
| 554 | 554 |
public void putOSGI(String lang, String key, String message) {
|
| 555 | 555 |
osgiKeys.add(key); |
| 556 | 556 |
|
| 557 |
File p = new File(javaMessageFile.getParentFile(), "bundle"+lang+".properties");
|
|
| 557 |
File p = new File(projectDirectory, "OSGI-INF/l10n/bundle"+lang+".properties");
|
|
| 558 | 558 |
|
| 559 | 559 |
if (!osgiLangs.containsKey(p)) {
|
| 560 | 560 |
osgiLangs.put(p, new HashMap<String, String>()); |
| ... | ... | |
| 652 | 652 |
propFile.delete(); |
| 653 | 653 |
newPropFile = propFile; |
| 654 | 654 |
} |
| 655 |
|
|
| 655 | 656 |
props.store(IOUtils.getWriter(newPropFile, "ISO-8859-1"), "TXM OSGI messages generated by the PluginMessagesManager class"); |
| 656 | 657 |
} |
| 657 |
|
|
| 658 |
|
|
| 658 | 659 |
// 2 Write messages*.properties prop File |
| 659 | 660 |
for (File propFile : langs.keySet()) {
|
| 660 | 661 |
|
| ... | ... | |
| 676 | 677 |
propFile.delete(); |
| 677 | 678 |
newPropFile = propFile; |
| 678 | 679 |
} |
| 679 |
props.store(IOUtils.getWriter(newPropFile, ENCODING), "TXM messages generated by the PluginMessagesManager class");
|
|
| 680 |
props.store(IOUtils.getWriter(newPropFile, UTF8), "TXM messages generated by the PluginMessagesManager class");
|
|
| 680 | 681 |
} |
| 681 | 682 |
|
| 682 | 683 |
// 3 write Java message File |
| 683 | 684 |
File newJavaMessageFile = new File(javaMessageFile.getParentFile(), javaMessageFile.getName()+".new"); |
| 684 | 685 |
|
| 685 |
ArrayList<String> lines = IOUtils.getLines(javaMessageFile, "UFT-8");
|
|
| 686 |
ArrayList<String> lines = IOUtils.getLines(javaMessageFile, UTF8);
|
|
| 686 | 687 |
TreeSet<String> oldKeys = new TreeSet<String>(IOUtils.findWithGroup(javaMessageFile, "public static String ([^\"=;]+);")); |
| 687 | 688 |
TreeSet<String> newKeys = new TreeSet<String>(messageKeys); |
| 688 | 689 |
TreeSet<String> writtenKeys = new TreeSet<String>(); |
| ... | ... | |
| 694 | 695 |
newJavaMessageFile = javaMessageFile; |
| 695 | 696 |
} |
| 696 | 697 |
|
| 697 |
PrintWriter out = IOUtils.getWriter(newJavaMessageFile, ENCODING);
|
|
| 698 |
PrintWriter out = IOUtils.getWriter(newJavaMessageFile, UTF8);
|
|
| 698 | 699 |
|
| 699 | 700 |
// update lines |
| 700 | 701 |
for (String line : lines) {
|
Formats disponibles : Unified diff