Révision 3905
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ExportMessagesToOneFile.java (revision 3905) | ||
---|---|---|
26 | 26 |
public class ExportMessagesToOneFile { |
27 | 27 |
|
28 | 28 |
public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException, IOException { |
29 |
|
|
29 | 30 |
WorkspaceMessagesManager wmm = new WorkspaceMessagesManager(); |
30 | 31 |
LinkedHashMap<File, PluginMessagesManager> h = wmm.getPluginMessages(); |
31 | 32 |
|
... | ... | |
73 | 74 |
System.out.println(lang+" "+mergedProps.get(lang).size()); |
74 | 75 |
File mergedPropFile = new File(wmm.getWorkspaceLocation(), "bundles/org.txm.translate.rcp/messages"+lang+".properties"); |
75 | 76 |
try { |
76 |
mergedProps.get(lang).store(IOUtils.getWriter(mergedPropFile), "compiled messages for lang="+lang); |
|
77 |
mergedProps.get(lang).store(IOUtils.getWriter(mergedPropFile, "iso-8859-1"), "compiled messages for lang="+lang);
|
|
77 | 78 |
System.out.println("See: "+mergedPropFile); |
78 | 79 |
} catch (IOException e) { |
79 | 80 |
// TODO Auto-generated catch block |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FixEncodingDeclarationInMessagesPropertiesFiles.java (revision 3905) | ||
---|---|---|
1 |
package org.txm.rcp.translate.devtools; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.FileNotFoundException; |
|
5 |
import java.io.IOException; |
|
6 |
import java.io.UnsupportedEncodingException; |
|
7 |
import java.util.LinkedHashMap; |
|
8 |
import java.util.Properties; |
|
9 |
|
|
10 |
import org.txm.rcp.translate.i18n.PluginMessagesManager; |
|
11 |
import org.txm.rcp.translate.i18n.WorkspaceMessagesManager; |
|
12 |
import org.txm.utils.io.IOUtils; |
|
13 |
|
|
14 |
/** |
|
15 |
* Test properties files : |
|
16 |
* - no duplicated key |
|
17 |
* - no empty message |
|
18 |
* |
|
19 |
* @author mdecorde |
|
20 |
* |
|
21 |
*/ |
|
22 |
public class FixEncodingDeclarationInMessagesPropertiesFiles { |
|
23 |
|
|
24 |
public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException, IOException { |
|
25 |
WorkspaceMessagesManager wmm = new WorkspaceMessagesManager(); |
|
26 |
LinkedHashMap<File, PluginMessagesManager> h = wmm.getPluginMessages(); |
|
27 |
|
|
28 |
String langs[] = {"", "_fr", "_ru"}; |
|
29 |
|
|
30 |
System.out.println("Fetching messages..."); |
|
31 |
for (File project : h.keySet()) { |
|
32 |
|
|
33 |
File settingsDir = new File(project, ".settings"); |
|
34 |
File ressourcePrefFile = new File(settingsDir, "org.eclipse.core.resources.prefs"); |
|
35 |
Properties content = new Properties(); |
|
36 |
if (ressourcePrefFile.exists()) { |
|
37 |
content.load(IOUtils.getReader(ressourcePrefFile)); |
|
38 |
} |
|
39 |
PluginMessagesManager messages = h.get(project); |
|
40 |
//System.out.println(" "+messages.getMessageFullName()+" -> "+messages.getMessageKeys().size()); |
|
41 |
|
|
42 |
// System.out.println("M"+project+"? "+messages.getMessageFile()); |
|
43 |
|
|
44 |
boolean modified = false; |
|
45 |
|
|
46 |
for (String lang : langs) { |
|
47 |
File propFile = messages.getFile2lang().getKey("messages"+lang); |
|
48 |
if (propFile == null) continue; |
|
49 |
//System.out.println("M="+propFile); |
|
50 |
String relPath = propFile.getAbsolutePath().substring(project.getAbsolutePath().length()); |
|
51 |
if (content.containsKey("encoding/"+relPath) && content.get("encoding/"+relPath).equals("UTF-8")) { |
|
52 |
System.out.println("OK UTF8: "+propFile); |
|
53 |
} else { |
|
54 |
System.out.println("KO UTF8: "+propFile); |
|
55 |
content.put("encoding/"+relPath, "UTF-8"); |
|
56 |
modified = true; |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
if (modified) { |
|
61 |
System.out.println("Fixing pref file"); |
|
62 |
content.store(IOUtils.getWriter(ressourcePrefFile), ""); |
|
63 |
} |
|
64 |
} |
|
65 |
} |
|
66 |
} |
|
0 | 67 |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindBugsInPropertiesFiles.java (revision 3905) | ||
---|---|---|
5 | 5 |
import java.io.IOException; |
6 | 6 |
import java.io.UnsupportedEncodingException; |
7 | 7 |
import java.util.LinkedHashMap; |
8 |
import java.util.Properties; |
|
9 | 8 |
|
10 | 9 |
import org.txm.rcp.translate.i18n.PluginMessagesManager; |
11 | 10 |
import org.txm.rcp.translate.i18n.WorkspaceMessagesManager; |
12 |
import org.txm.utils.io.IOUtils; |
|
13 | 11 |
|
14 | 12 |
/** |
15 | 13 |
* Test properties files : |
... | ... | |
30 | 28 |
System.out.println("Fetching messages..."); |
31 | 29 |
for (File project : h.keySet()) { |
32 | 30 |
|
33 |
File settingsDir = new File(project, ".settings"); |
|
34 |
File ressourcePrefFile = new File(settingsDir, "org.eclipse.core.resources.prefs"); |
|
35 |
Properties content = new Properties(); |
|
36 |
if (ressourcePrefFile.exists()) { |
|
37 |
content.load(IOUtils.getReader(ressourcePrefFile)); |
|
38 |
} |
|
39 | 31 |
PluginMessagesManager messages = h.get(project); |
40 |
//System.out.println(" "+messages.getMessageFullName()+" -> "+messages.getMessageKeys().size()); |
|
41 | 32 |
|
42 |
// System.out.println("M"+project+"? "+messages.getMessageFile()); |
|
43 |
|
|
44 |
boolean modified = false; |
|
45 |
|
|
46 | 33 |
for (String lang : langs) { |
47 | 34 |
File propFile = messages.getFile2lang().getKey("messages"+lang); |
48 | 35 |
if (propFile == null) continue; |
49 |
//System.out.println("M="+propFile); |
|
50 |
String relPath = propFile.getAbsolutePath().substring(project.getAbsolutePath().length()); |
|
51 |
if (content.containsKey("encoding/"+relPath) && content.get("encoding/"+relPath).equals("UTF-8")) { |
|
52 |
System.out.println("OK UTF8: "+propFile); |
|
53 |
} else { |
|
54 |
System.out.println("KO UTF8: "+propFile); |
|
55 |
content.put("encoding/"+relPath, "UTF-8"); |
|
56 |
modified = true; |
|
57 |
} |
|
36 |
|
|
58 | 37 |
} |
59 |
|
|
60 |
if (modified) { |
|
61 |
System.out.println("Fixing pref file"); |
|
62 |
content.store(IOUtils.getWriter(ressourcePrefFile), ""); |
|
63 |
} |
|
64 | 38 |
} |
65 | 39 |
} |
66 | 40 |
} |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ExportOSGiXMLToOneFile.java (revision 3905) | ||
---|---|---|
79 | 79 |
System.out.println(lang+" "+mergedProps.get(lang).size()); |
80 | 80 |
File mergedPropFile = new File(wmm.getWorkspaceLocation(), "bundles/org.txm.translate.rcp/bundle"+lang+".properties"); |
81 | 81 |
try { |
82 |
mergedProps.get(lang).store(IOUtils.getWriter(mergedPropFile), "compiled messages for lang="+lang); |
|
82 |
mergedProps.get(lang).store(IOUtils.getWriter(mergedPropFile, "iso-8859-1"), "compiled messages for lang="+lang);
|
|
83 | 83 |
System.out.println("See: "+mergedPropFile); |
84 | 84 |
} catch (IOException e) { |
85 | 85 |
// TODO Auto-generated catch block |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ImportPluginXMLFromOneFile.java (revision 3905) | ||
---|---|---|
35 | 35 |
|
36 | 36 |
File mergedPropertiesFile = new File(wmm.getWorkspaceLocation(), "org.txm.translate.rcp/bundle" + lang + ".properties"); |
37 | 37 |
Properties mergedProperties = new Properties(); |
38 |
mergedProperties.load(IOUtils.getReader(mergedPropertiesFile)); |
|
38 |
mergedProperties.load(IOUtils.getReader(mergedPropertiesFile, "iso-8859-1"));
|
|
39 | 39 |
|
40 | 40 |
if (mergedProperties.size() == 0) { |
41 | 41 |
System.out.println(" No messages to update"); |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/CreateMessagesTable.java (revision 3905) | ||
---|---|---|
35 | 35 |
|
36 | 36 |
System.out.println("Building table..."); |
37 | 37 |
Properties master = new Properties(); |
38 |
master.load(IOUtils.getReader(defaultPropertiesFile, "UTF-8")); |
|
38 |
String encoding = "UTF-8"; |
|
39 |
if (prefix.startsWith("bundle")) { |
|
40 |
encoding = "iso-8859-1"; |
|
41 |
} |
|
42 |
master.load(IOUtils.getReader(defaultPropertiesFile, encoding)); |
|
39 | 43 |
|
40 | 44 |
Properties slave = new Properties(); |
41 |
slave.load(IOUtils.getReader(langPropertiesFile, "UTF-8"));
|
|
45 |
slave.load(IOUtils.getReader(langPropertiesFile, encoding));
|
|
42 | 46 |
|
43 | 47 |
OdfTextDocument doc = OdfTextDocument.newTextDocument(); |
44 | 48 |
|
... | ... | |
79 | 83 |
|
80 | 84 |
File langPropertiesFile = new File(dir, prefix+"_"+lang+".properties"); |
81 | 85 |
|
86 |
String encoding = "UTF-8"; |
|
87 |
if (prefix.startsWith("bundle")) { |
|
88 |
encoding = "iso-8859-1"; |
|
89 |
} |
|
90 |
|
|
82 | 91 |
System.out.println("Building table..."); |
83 | 92 |
Properties master = new Properties(); |
84 |
master.load(IOUtils.getReader(defaultPropertiesFile, "UTF-8"));
|
|
93 |
master.load(IOUtils.getReader(defaultPropertiesFile, encoding));
|
|
85 | 94 |
|
86 | 95 |
Properties slave = new Properties(); |
87 |
slave.load(IOUtils.getReader(langPropertiesFile, "UTF-8"));
|
|
96 |
slave.load(IOUtils.getReader(langPropertiesFile, encoding));
|
|
88 | 97 |
|
89 | 98 |
OdfSpreadsheetDocument spreadsheet = OdfSpreadsheetDocument.newSpreadsheetDocument(); |
90 | 99 |
|
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/TableToProperties.java (revision 3905) | ||
---|---|---|
17 | 17 |
String lang; |
18 | 18 |
|
19 | 19 |
public TableToProperties(File tableFile, String lang) { |
20 |
|
|
20 | 21 |
this.tableFile = tableFile; |
21 | 22 |
this.lang = lang; |
22 | 23 |
} |
... | ... | |
96 | 97 |
// |
97 | 98 |
// System.out.println("NEWPROPERTIES: "+newProperties); |
98 | 99 |
// |
99 |
// PrintWriter writer = IOUtils.getWriter(new File("/home/mdecorde/TEMP/newvalues_default.properties"), "iso-8859-1");
|
|
100 |
// PrintWriter writer = IOUtils.getWriter(new File("/home/mdecorde/TEMP/newvalues_default.properties"), "UTF-8");
|
|
100 | 101 |
// newProperties.store(writer, ""); |
101 | 102 |
// writer.close(); |
102 | 103 |
|
... | ... | |
104 | 105 |
Properties previousOKProperties = new TableToProperties(new File("/home/mdecorde/TEMP/messagespaskc.odt"), "default").convert(); |
105 | 106 |
|
106 | 107 |
File newValuesPropertiesFile = new File("/home/mdecorde/TEMP/newvalues_default.properties"); |
107 |
BufferedReader reader = IOUtils.getReader(newValuesPropertiesFile, "iso-8859-1");
|
|
108 |
BufferedReader reader = IOUtils.getReader(newValuesPropertiesFile, "UTF-8");
|
|
108 | 109 |
Properties newProperties2 = new Properties(); |
109 | 110 |
newProperties2.load(reader); |
110 | 111 |
reader.close(); |
... | ... | |
113 | 114 |
previousOKProperties.setProperty(k.toString(), newProperties2.getProperty(k.toString())); |
114 | 115 |
} |
115 | 116 |
|
116 |
PrintWriter writer = IOUtils.getWriter(new File("/home/mdecorde/TEMP/bundle.properties"), "UTF-8");
|
|
117 |
PrintWriter writer = IOUtils.getWriter(new File("/home/mdecorde/TEMP/bundle.properties"), "iso-8859-1");
|
|
117 | 118 |
previousOKProperties.store(writer, ""); |
118 | 119 |
writer.close(); |
119 | 120 |
} |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/TableFileToPropertiesFile.java (revision 3905) | ||
---|---|---|
22 | 22 |
|
23 | 23 |
Properties slave = new TableToProperties(tableFile, lang).convert(); |
24 | 24 |
|
25 |
PrintWriter writer = IOUtils.getWriter(propertiesFile, "iso-8859-1"); |
|
25 |
String encoding = "UTF-8"; |
|
26 |
if (tableFile.getName().startsWith("bundle")) { |
|
27 |
encoding = "iso-8859-1"; |
|
28 |
} |
|
29 |
|
|
30 |
PrintWriter writer = IOUtils.getWriter(propertiesFile, encoding); |
|
26 | 31 |
slave.store(writer, ""); |
27 | 32 |
writer.close(); |
28 | 33 |
|
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/FindMessagesToBind.java (revision 3905) | ||
---|---|---|
40 | 40 |
|
41 | 41 |
private int processSourceFile(File sourceFile, boolean searchOnlyExternalized) { |
42 | 42 |
|
43 |
|
|
44 | 43 |
// BufferedReader reader = IOUtils.getReader(sourceFile) |
45 | 44 |
// String line = reader.readLine(); |
46 | 45 |
this.searchOnlyExternalized = searchOnlyExternalized; |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/devtools/ImportMessagesTable.java (revision 3905) | ||
---|---|---|
60 | 60 |
} |
61 | 61 |
}; |
62 | 62 |
|
63 |
slave.load(IOUtils.getReader(langPropertiesFile, "UTF-8")); |
|
63 |
String encoding = "UTF-8"; |
|
64 |
if (prefix.startsWith("bundle")) { |
|
65 |
encoding = "iso-8859-1"; |
|
66 |
} |
|
64 | 67 |
|
68 |
slave.load(IOUtils.getReader(langPropertiesFile, encoding)); |
|
69 |
|
|
65 | 70 |
OdfTextDocument doc = OdfTextDocument.loadDocument(tableFile); |
66 | 71 |
OdfTable table = doc.getTableList(false).get(0); |
67 | 72 |
|
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/PluginMessagesManager.java (revision 3905) | ||
---|---|---|
261 | 261 |
for (File propFile : osgiInf.listFiles(IOUtils.HIDDENFILE_FILTER)) { |
262 | 262 |
if (propFile.getName().startsWith("bundle") && propFile.getName().endsWith(".properties")) { |
263 | 263 |
Properties props = new Properties(); |
264 |
props.load(IOUtils.getReader(propFile, "ISO-8859-1"));
|
|
264 |
props.load(IOUtils.getReader(propFile, "iso-8859-1"));
|
|
265 | 265 |
HashMap<String, String> h = new HashMap<>(); |
266 | 266 |
for (Object k : props.keySet()) |
267 | 267 |
h.put(k.toString(), props.getProperty(k.toString())); |
... | ... | |
696 | 696 |
propFile.delete(); |
697 | 697 |
newPropFile = propFile; |
698 | 698 |
} |
699 |
|
|
700 |
String encoding = "UTF-8"; |
|
701 |
if (newPropFile.getName().startsWith("bundle")) { |
|
702 |
encoding = "iso-8859-1"; |
|
703 |
} |
|
704 |
|
|
705 |
|
|
699 | 706 |
if (propFile.getName().contains("_ru.properties")) { |
700 | 707 |
utf8fixes = true; |
701 | 708 |
cmds.append("native2ascii " + newPropFile + " > " + newPropFile + ".tmp\n"); |
702 | 709 |
cmds.append("rm " + newPropFile + "\n"); |
703 | 710 |
cmds.append("mv " + newPropFile + ".tmp " + newPropFile + "\n"); |
704 |
props.store(IOUtils.getWriter(newPropFile, "UTF-8"), "TXM OSGI messages generated by the PluginMessagesManager class");
|
|
711 |
props.store(IOUtils.getWriter(newPropFile, encoding), "TXM OSGI messages generated by the PluginMessagesManager class");
|
|
705 | 712 |
} |
706 | 713 |
else { |
707 |
props.store(IOUtils.getWriter(newPropFile, "ISO-8859-1"), "TXM OSGI messages generated by the PluginMessagesManager class");
|
|
714 |
props.store(IOUtils.getWriter(newPropFile, encoding), "TXM OSGI messages generated by the PluginMessagesManager class");
|
|
708 | 715 |
} |
709 | 716 |
} |
710 | 717 |
if (utf8fixes) { |
... | ... | |
775 | 782 |
out.println("\t"); |
776 | 783 |
} |
777 | 784 |
for (String key : newKeys) { |
785 |
|
|
778 | 786 |
if (writtenKeys.contains(key)) continue; // key already written |
779 | 787 |
out.println("\tpublic static String " + key + ";"); |
780 | 788 |
writtenKeys.add(key); |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/WorkspaceMessagesManager.java (revision 3905) | ||
---|---|---|
323 | 323 |
PluginMessagesManager pm = pms.get(pmk); |
324 | 324 |
System.out.println("PMK="+pmk+" messages="+pm.getMessageKeys().size()+" osgi="+pm.getOsgiKeys().size()); |
325 | 325 |
} |
326 |
|
|
326 | 327 |
//wmm.dumpUsedKeysFilesIndex(); |
327 | 328 |
//wmm.saveKeyModificationsInSources(); |
328 | 329 |
} |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/FixExternalizedDuplicatedStrings.groovy (revision 3905) | ||
---|---|---|
10 | 10 |
class FixExternalizedDuplicatedStrings { |
11 | 11 |
|
12 | 12 |
static main(args) { |
13 |
|
|
13 | 14 |
// File propertyFile = new File("/home/mdecorde/Bureau/Experiences/rcp/messages.properties"); |
14 | 15 |
// File messageClass = new File("/home/mdecorde/Bureau/Experiences/rcp/Messages.java"); |
15 | 16 |
// File srcdirectory = new File("/home/mdecorde/Bureau/Experiences/rcp"); |
16 | 17 |
File propertyFile = new File("/home/mdecorde/workspace37/org.txm.rcp/src/main/java/org/txm/rcp/messages.properties"); |
17 | 18 |
File messageClass = new File("/home/mdecorde/workspace37/org.txm.rcp/src/main/java/org/txm/rcp/Messages.java"); |
18 | 19 |
File srcdirectory = new File("/home/mdecorde/workspace37/org.txm.rcp/src/main/java/org/txm/rcp"); |
20 |
|
|
19 | 21 |
if (!(propertyFile.exists() && propertyFile.canRead() && propertyFile.canWrite() && propertyFile.isFile())) { |
20 | 22 |
println "error file : "+propertyFile |
21 | 23 |
return |
... | ... | |
24 | 26 |
// build hash of externalised Strings |
25 | 27 |
// key externalized string |
26 | 28 |
def entries = new HashMap<String, String>() |
27 |
propertyFile.eachLine("iso-8859-1"){ |
|
28 |
if(it =~ ".+=.+") |
|
29 |
{ |
|
29 |
|
|
30 |
String encoding = "UTF-8"; |
|
31 |
if (propertyFile.getName().startsWith("bundle")) { |
|
32 |
encoding = "iso-8859-1"; |
|
33 |
} |
|
34 |
|
|
35 |
propertyFile.eachLine(encoding){ |
|
36 |
if (it =~ ".+=.+") { |
|
30 | 37 |
int idx = it.indexOf("=") |
31 | 38 |
String key = it.substring(0, idx) |
32 | 39 |
String value = it.substring(idx+1) |
33 | 40 |
entries.put(key, value) |
34 | 41 |
} |
35 |
else if(it =~ ".+=\$") |
|
36 |
{ |
|
42 |
else if (it =~ ".+=\$") { |
|
37 | 43 |
int idx = it.indexOf("=") |
38 | 44 |
String key = it.substring(0, idx) |
39 | 45 |
String value = "" |
... | ... | |
45 | 51 |
def hash = entries |
46 | 52 |
def reverse = [:] |
47 | 53 |
hash.each{ |
48 |
if(reverse[it.value] == null)
|
|
54 |
if (reverse[it.value] == null) {
|
|
49 | 55 |
reverse[it.value] = [] |
56 |
} |
|
50 | 57 |
reverse[it.value] << it.key |
51 | 58 |
}; |
52 | 59 |
|
... | ... | |
56 | 63 |
|
57 | 64 |
// translate dictionnary |
58 | 65 |
def dictionnary = [:] |
59 |
for(def value : reverse.keySet())
|
|
60 |
{ |
|
66 |
for (def value : reverse.keySet()) {
|
|
67 |
|
|
61 | 68 |
def keys = reverse[value]; |
62 | 69 |
def first = keys[0]; |
63 |
for(int i = 1 ; i < keys.size() ; i++) // the first key will not be removed |
|
70 |
for (int i = 1 ; i < keys.size() ; i++) // the first key will not be removed
|
|
64 | 71 |
{ |
65 | 72 |
def key = keys.get(i) |
66 |
if(key != first) |
|
67 |
{ |
|
73 |
if (key != first) { |
|
68 | 74 |
dictionnary.put(key , first) |
69 | 75 |
println key+ " >> "+first |
70 | 76 |
} |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/Merge2PropertiesFile.groovy (revision 3905) | ||
---|---|---|
4 | 4 |
File propFile2 = new File("/home/mdecorde/workspace047/org.txm.rcp.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages_fr.properties") |
5 | 5 |
|
6 | 6 |
Properties props1 = new Properties() |
7 |
props1.load(propFile1.newReader("iso-8859-1"))
|
|
7 |
props1.load(propFile1.newReader("UTF-8"))
|
|
8 | 8 |
Properties props2 = new Properties() |
9 |
props2.load(propFile2.newReader("iso-8859-1"))
|
|
9 |
props2.load(propFile2.newReader("UTF-8"))
|
|
10 | 10 |
|
11 | 11 |
println "props1.size = "+props1.size() |
12 | 12 |
println "props2.size = "+props2.size() |
... | ... | |
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
println "props2.size AFTER = "+props2.size() |
20 |
props2.store(propFile2.newWriter("iso-8859-1"), "$propFile1 + $propFile2") |
|
20 |
props2.store(propFile2.newWriter("UTF-8"), "$propFile1 + $propFile2") |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/ExternalizationFilesUpdater.java (revision 3905) | ||
---|---|---|
91 | 91 |
*/ |
92 | 92 |
public List<String> getEntries(File file) throws IOException |
93 | 93 |
{ |
94 |
List<String> entries = new ArrayList<>(); |
|
95 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file) , "iso-8859-1")); |
|
94 |
List<String> entries = new ArrayList<>(); |
|
95 |
|
|
96 |
String encoding = "UTF-8"; |
|
97 |
if (file.getName().startsWith("bundle")) { |
|
98 |
encoding = "iso-8859-1"; |
|
99 |
} |
|
100 |
|
|
101 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file) , encoding)); |
|
96 | 102 |
String line = reader.readLine(); |
97 | 103 |
while (line != null) { |
98 | 104 |
String[] split = line.split("=", 2); |
... | ... | |
114 | 120 |
* @throws IOException |
115 | 121 |
*/ |
116 | 122 |
public HashMap<String, String> getValues(File file) throws IOException { |
117 |
HashMap<String, String> values = new HashMap<String, String>(); |
|
118 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "iso-8859-1")); |
|
123 |
HashMap<String, String> values = new HashMap<String, String>(); |
|
124 |
|
|
125 |
String encoding = "UTF-8"; |
|
126 |
if (file.getName().startsWith("bundle")) { |
|
127 |
encoding = "iso-8859-1"; |
|
128 |
} |
|
129 |
|
|
130 |
|
|
131 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); |
|
119 | 132 |
String line = reader.readLine(); |
120 |
while (line != null) { |
|
133 |
while (line != null) { |
|
134 |
|
|
121 | 135 |
String[] split = line.split("="); |
122 | 136 |
if (split.length > 0) { |
123 | 137 |
String key = split[0]; |
124 | 138 |
String concat = ""; |
125 |
for (int i = 1; i < split.length; i++) |
|
126 |
concat += split[i]; |
|
139 |
for (int i = 1; i < split.length; i++) { |
|
140 |
concat += split[i]; |
|
141 |
} |
|
127 | 142 |
values.put(key, concat); |
128 | 143 |
} |
129 | 144 |
line = reader.readLine(); |
... | ... | |
137 | 152 |
*/ |
138 | 153 |
public void processFoundDirectories() throws IOException |
139 | 154 |
{ |
140 |
for (File dirfile : dirfiles) { |
|
155 |
for (File dirfile : dirfiles) { |
|
156 |
|
|
141 | 157 |
System.out.println("DIRECTORY : "+dirfile); |
142 | 158 |
List<File> files = propertyfiles.get(dirfile); |
143 | 159 |
for (File f : files) { |
... | ... | |
167 | 183 |
|
168 | 184 |
this.fileentries.put(f, this.fileentries.get(reference)); // update file entries |
169 | 185 |
|
170 |
if (tmp1.size() > 0 || refentries.size() > 0) |
|
171 |
System.out.println( " "+f.getName()); |
|
172 |
if (tmp1.size() > 0) |
|
186 |
if (tmp1.size() > 0 || refentries.size() > 0) { |
|
187 |
System.out.println( " "+f.getName()); |
|
188 |
} |
|
189 |
if (tmp1.size() > 0) { |
|
173 | 190 |
System.out.println(" Removed keys : "+tmp1); |
174 |
if (refentries.size() > 0) |
|
175 |
System.out.println(" Added keys : "+refentries); |
|
191 |
} |
|
192 |
if (refentries.size() > 0) { |
|
193 |
System.out.println(" Added keys : "+refentries); |
|
194 |
} |
|
176 | 195 |
} |
177 | 196 |
} |
178 | 197 |
} |
... | ... | |
183 | 202 |
* Update files. |
184 | 203 |
* @throws IOException |
185 | 204 |
*/ |
186 |
public void updateFiles() throws IOException
|
|
187 |
{ |
|
188 |
for(File dirfile : dirfiles)
|
|
189 |
{ |
|
205 |
public void updateFiles() throws IOException {
|
|
206 |
|
|
207 |
for (File dirfile : dirfiles) {
|
|
208 |
|
|
190 | 209 |
List<File> files = propertyfiles.get(dirfile); |
191 |
for(File f : files)
|
|
192 |
{ |
|
210 |
for (File f : files) {
|
|
211 |
|
|
193 | 212 |
List<String> entries = this.fileentries.get(f); |
194 | 213 |
HashMap<String, String> values = this.fileentriesvalues.get(f); |
214 |
|
|
215 |
String encoding = "UTF-8"; |
|
216 |
if (f.getName().startsWith("bundle")) { |
|
217 |
encoding = "iso-8859-1"; |
|
218 |
} |
|
195 | 219 |
|
196 |
Writer writer = new OutputStreamWriter(new FileOutputStream(f) , "iso-8859-1"); |
|
197 |
for(String entry : entries) |
|
198 |
{ |
|
220 |
Writer writer = new OutputStreamWriter(new FileOutputStream(f) , encoding); |
|
221 |
for (String entry : entries) { |
|
199 | 222 |
writer.write(entry+"="+values.get(entry)+"\n"); |
200 | 223 |
} |
201 | 224 |
writer.close(); |
... | ... | |
209 | 232 |
* @param suffix the suffix |
210 | 233 |
* @throws IOException |
211 | 234 |
*/ |
212 |
public void createMissingFiles(String suffix) throws IOException
|
|
213 |
{ |
|
235 |
public void createMissingFiles(String suffix) throws IOException {
|
|
236 |
|
|
214 | 237 |
System.out.println("Looking for missing messages files "+ suffix); |
215 |
for(File dirfile : dirfiles) { |
|
238 |
for (File dirfile : dirfiles) {
|
|
216 | 239 |
//println "DIRECTORY : "+dirfile |
217 | 240 |
File reference = null; |
218 | 241 |
String lookingname = ""; |
219 | 242 |
List<File> files = propertyfiles.get(dirfile); |
220 |
if (files.get(0).getName().startsWith("m")) { |
|
243 |
if (files.get(0).getName().startsWith("m")) { |
|
244 |
|
|
221 | 245 |
reference = new File(dirfile,"messages.properties"); |
222 | 246 |
lookingname = "messages_"+suffix+".properties"; |
223 | 247 |
} |
224 |
else if (files.get(0).getName().startsWith("b"))
|
|
225 |
{ |
|
248 |
else if (files.get(0).getName().startsWith("b")) {
|
|
249 |
|
|
226 | 250 |
reference = new File(dirfile,"bundle.properties"); |
227 | 251 |
lookingname = "bundle_"+suffix+".properties"; |
228 | 252 |
} |
229 | 253 |
|
230 | 254 |
boolean create = true; |
231 | 255 |
if (reference != null && reference.exists()) { |
232 |
for(File f : files) |
|
233 |
{ |
|
256 |
for (File f : files) { |
|
234 | 257 |
if(f.getName() == lookingname) |
235 | 258 |
create = false; |
236 | 259 |
} |
237 |
} |
|
260 |
} |
|
261 |
|
|
238 | 262 |
if (create) { |
239 | 263 |
new File(dirfile,lookingname).createNewFile(); |
240 | 264 |
System.out.println("Create file " +new File(dirfile,lookingname)); |
... | ... | |
248 | 272 |
public String toString() { |
249 | 273 |
|
250 | 274 |
String rez = ""; |
251 |
for(File dirfile : dirfiles) { |
|
275 |
for (File dirfile : dirfiles) {
|
|
252 | 276 |
rez += dirfile+"\n"; |
253 |
for(File f : propertyfiles.get(dirfile)) |
|
254 |
rez += " "+f.getName()+"\n"; |
|
277 |
for (File f : propertyfiles.get(dirfile)) { |
|
278 |
rez += " "+f.getName()+"\n"; |
|
279 |
} |
|
255 | 280 |
} |
256 | 281 |
return rez; |
257 | 282 |
} |
... | ... | |
261 | 286 |
* |
262 | 287 |
* @param directory the directory |
263 | 288 |
*/ |
264 |
public void scanDirectory(File directory)
|
|
265 |
{ |
|
289 |
public void scanDirectory(File directory) {
|
|
290 |
|
|
266 | 291 |
if (!directory.exists()) { |
267 | 292 |
System.out.println("directory '$directory' does not exists"); |
268 | 293 |
return; |
... | ... | |
272 | 297 |
LinkedList<File> files = new LinkedList<File>(); |
273 | 298 |
files.add(directory); |
274 | 299 |
|
275 |
while(!files.isEmpty()) { |
|
300 |
while (!files.isEmpty()) {
|
|
276 | 301 |
|
277 | 302 |
File current = files.removeFirst(); |
278 | 303 |
if (current.isDirectory()) { |
279 | 304 |
List<File> currentpfiles = new ArrayList<>(); |
280 |
for(File sfile : current.listFiles(IOUtils.HIDDENFILE_FILTER))
|
|
281 |
{ |
|
282 |
if(sfile.isDirectory()) { |
|
305 |
for (File sfile : current.listFiles(IOUtils.HIDDENFILE_FILTER)) {
|
|
306 |
|
|
307 |
if (sfile.isDirectory()) {
|
|
283 | 308 |
files.add(sfile); |
284 | 309 |
} else if(sfile.getName().endsWith(".properties") && ( sfile.getName().startsWith("messages") || sfile.getName().startsWith("bundle")) ) { |
285 | 310 |
currentpfiles.add(sfile); |
... | ... | |
299 | 324 |
* @param args the arguments |
300 | 325 |
* @throws IOException |
301 | 326 |
*/ |
302 |
public static void main(String[] args) throws IOException
|
|
303 |
{ |
|
327 |
public static void main(String[] args) throws IOException {
|
|
328 |
|
|
304 | 329 |
String userdir = System.getProperty("user.home"); |
305 | 330 |
|
306 | 331 |
System.out.println("\nRCP\n"); |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/FindDuplicatedKeyProperties.groovy (revision 3905) | ||
---|---|---|
54 | 54 |
|
55 | 55 |
for (def file : propertieFileToJavaFile.keySet()) { |
56 | 56 |
Properties newProperties = new Properties(); |
57 |
newProperties.load(IOUtils.getReader(file, "UTF-8")); |
|
57 |
String encoding = "UTF-8"; |
|
58 |
if (file.getName().startsWith("bundle")) { |
|
59 |
encoding = "iso-8859-1"; |
|
60 |
} |
|
58 | 61 |
|
62 |
newProperties.load(IOUtils.getReader(file, encoding)); |
|
63 |
|
|
59 | 64 |
propertiesToMessageFile[file] = newProperties; |
60 | 65 |
messagesFileToProperties[newProperties] = file; |
61 | 66 |
|
... | ... | |
88 | 93 |
def messages = [:] |
89 | 94 |
for (def file : propertiesFiles) { |
90 | 95 |
Properties newProperties = new Properties(); |
96 |
String encoding = "UTF-8"; |
|
97 |
if (file.getName().startsWith("bundle")) { |
|
98 |
encoding = "iso-8859-1"; |
|
99 |
} |
|
91 | 100 |
newProperties.load(IOUtils.getReader(file, "UTF-8")); |
92 | 101 |
messages[file] = newProperties; |
93 | 102 |
} |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/I18nDiff.groovy (revision 3905) | ||
---|---|---|
12 | 12 |
Properties values1, values2; |
13 | 13 |
File file1; |
14 | 14 |
File file2; |
15 |
|
|
15 |
|
|
16 | 16 |
def notInValues1, notInValues2 |
17 | 17 |
I18nDiff(File file1, File file2) { |
18 | 18 |
this.file1 = file1 |
19 | 19 |
this.file2 = file2 |
20 | 20 |
values1 = getValues(file1) |
21 | 21 |
values2 = getValues(file2) |
22 |
|
|
22 |
|
|
23 | 23 |
def inter = values1.keySet().intersect(values2.keySet()); |
24 | 24 |
notInValues1 = values2.keySet().minus(values1.keySet()); |
25 | 25 |
notInValues2 = values1.keySet().minus(values2.keySet()); |
26 |
|
|
26 |
|
|
27 | 27 |
println "not in $file1" |
28 | 28 |
for(String key : notInValues1) |
29 | 29 |
if (key.trim().length() > 0) |
30 | 30 |
println key+" = "+values2.get(key) |
31 |
|
|
31 |
|
|
32 | 32 |
println "not in $file2" |
33 | 33 |
for(String key : notInValues2) |
34 | 34 |
if (key.trim().length() > 0) |
35 | 35 |
println key+" = "+values1.get(key) |
36 |
|
|
36 |
|
|
37 | 37 |
// println "values diff" |
38 | 38 |
// |
39 | 39 |
// for(String key : inter ) { |
... | ... | |
41 | 41 |
// println key+" = "+values1.get(key)+" != "+values2.get(key) |
42 | 42 |
// } |
43 | 43 |
} |
44 |
|
|
44 |
|
|
45 | 45 |
public void synchronizeFromF1toF2() { |
46 | 46 |
|
47 |
for(String key : notInValues2) { |
|
47 |
for (String key : notInValues2) {
|
|
48 | 48 |
if (key.trim().length() > 0) |
49 | 49 |
values2.setProperty(key, "NA_"+values1.get(key)); |
50 | 50 |
} |
51 | 51 |
|
52 |
for(String key : notInValues1)
|
|
52 |
for (String key : notInValues1) {
|
|
53 | 53 |
if (key.trim().length() > 0) |
54 | 54 |
values2.remove(key) |
55 |
|
|
56 |
file2.withWriter("iso-8859-1") { writer -> |
|
55 |
} |
|
56 |
|
|
57 |
String encoding = "UTF-8"; |
|
58 |
if (file2.getName().startsWith("bundle")) { |
|
59 |
encoding = "iso-8859-1"; |
|
60 |
} |
|
61 |
|
|
62 |
file2.withWriter(encoding) { writer -> |
|
57 | 63 |
values2.store(writer, "") |
58 | 64 |
} |
59 | 65 |
} |
60 |
|
|
66 |
|
|
61 | 67 |
/** |
62 | 68 |
* Gets the values. |
63 | 69 |
* |
... | ... | |
65 | 71 |
* @return the values |
66 | 72 |
*/ |
67 | 73 |
public Properties getValues(File file) { |
74 |
|
|
68 | 75 |
Properties props = new Properties(); |
69 |
file.withReader("iso-8859-1") { input-> |
|
76 |
|
|
77 |
String encoding = "UTF-8"; |
|
78 |
if (file.getName().startsWith("bundle")) { |
|
79 |
encoding = "iso-8859-1"; |
|
80 |
} |
|
81 |
|
|
82 |
file.withReader(encoding) { input-> |
|
70 | 83 |
props.load(input); |
71 | 84 |
input.close() |
72 | 85 |
} |
73 | 86 |
return props; |
74 | 87 |
} |
75 |
|
|
88 |
|
|
76 | 89 |
public static void main(String[] args) { |
90 |
|
|
77 | 91 |
String userhome = System.getProperty("user.home"); |
78 | 92 |
File f1 = new File(userhome, "workspace047/org.txm.rcp/OSGI-INF/l10n/bundle.properties") |
79 | 93 |
File f2 = new File(userhome, "workspace047/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties") |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/MergeExternalizedStringFiles.groovy (revision 3905) | ||
---|---|---|
57 | 57 |
public String findBundle(File message) |
58 | 58 |
{ |
59 | 59 |
String ret; |
60 |
message.eachLine("iso-8859-1") { |
|
60 |
|
|
61 |
String encoding = "UTF-8"; |
|
62 |
if (message.getName().startsWith("bundle")) { |
|
63 |
encoding = "iso-8859-1"; |
|
64 |
} |
|
65 |
|
|
66 |
message.eachLine(encoding) { |
|
61 | 67 |
if (it.contains("private static final String BUNDLE_NAME = ")) { |
62 | 68 |
int start = it.indexOf("\"") |
63 | 69 |
int end = it.lastIndexOf("\"") |
... | ... | |
122 | 128 |
// Lang Key externalized string |
123 | 129 |
HashMap<String, HashMap<String, String>> externalizedLines = [:]; |
124 | 130 |
for (File source : externalized) { |
131 |
|
|
125 | 132 |
def lines = new HashMap<String, String>(); |
126 | 133 |
externalizedLines.put(source.getName(), lines); |
127 |
source.eachLine("iso-8859-1"){ |
|
134 |
source.eachLine("UTF-8") { |
|
135 |
|
|
128 | 136 |
if (it =~ ".+=.+") { |
129 | 137 |
int idx = it.indexOf("="); |
130 | 138 |
lines.put(it.substring(0, idx), it.substring(idx+1)) |
131 |
} else if(it =~ ".+=\$") { |
|
139 |
} else if (it =~ ".+=\$") {
|
|
132 | 140 |
int idx = it.indexOf("=") |
133 | 141 |
String key = it.substring(0, idx) |
134 | 142 |
String value = "" |
... | ... | |
139 | 147 |
|
140 | 148 |
// get references keys |
141 | 149 |
HashSet<String> refKeys = new HashSet<String>(); |
142 |
refClass.eachLine("iso-8859-1") {
|
|
150 |
refClass.eachLine("UTF-8") {
|
|
143 | 151 |
if (it =~ ".+public static String .+") |
144 | 152 |
refKeys << it.trim() |
145 | 153 |
} |
... | ... | |
159 | 167 |
// merge externalized strings |
160 | 168 |
for (File source : srcExternalized) { |
161 | 169 |
def lines = externalizedLines.get(source.getName()); |
162 |
source.eachLine("iso-8859-1") {
|
|
170 |
source.eachLine("UTF-8") {
|
|
163 | 171 |
if (it =~ ".+=.+") { |
164 | 172 |
int idx = it.indexOf("=") |
165 | 173 |
String key = it.substring(0, idx) |
... | ... | |
187 | 195 |
println srcExternalized |
188 | 196 |
continue; |
189 | 197 |
} |
190 |
srcClass.eachLine("iso-8859-1"){
|
|
198 |
srcClass.eachLine("UTF-8"){
|
|
191 | 199 |
if(it =~ ".+public static String .+") |
192 | 200 |
{ |
193 | 201 |
// if(refKeys.contains(it.trim())) |
... | ... | |
243 | 251 |
// write externalized lines |
244 | 252 |
for(File source : externalized) |
245 | 253 |
{ |
246 |
source.withWriter("iso-8859-1") { out ->
|
|
254 |
source.withWriter("UTF-8") { out ->
|
|
247 | 255 |
def hash = externalizedLines.get(source.getName()) |
248 | 256 |
def keys = hash.keySet(); |
249 | 257 |
keys = keys.sort() |
... | ... | |
254 | 262 |
} |
255 | 263 |
|
256 | 264 |
// write classRef File |
257 |
refClass.withWriter("iso-8859-1") { out ->
|
|
265 |
refClass.withWriter("UTF-8") { out ->
|
|
258 | 266 |
// write start |
259 | 267 |
out.writeLine(''' |
260 | 268 |
package org.txm.scripts.; |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/IsStringUsedInPlugin.groovy (revision 3905) | ||
---|---|---|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
props = new Properties(); |
19 |
propertyFile.withReader("iso-8859-1") { input-> |
|
19 |
|
|
20 |
String encoding = "UTF-8"; |
|
21 |
if (propertyFile.getName().startsWith("bundle")) { |
|
22 |
encoding = "iso-8859-1"; |
|
23 |
} |
|
24 |
|
|
25 |
propertyFile.withReader(encoding) { input-> |
|
20 | 26 |
props.load(input); |
21 | 27 |
input.close() |
22 | 28 |
} |
... | ... | |
44 | 50 |
|
45 | 51 |
public boolean writeFixes(File propertyFile) { |
46 | 52 |
if (props == null) return false; |
47 |
propertyFile.withWriter("iso-8859-1") { output -> |
|
53 |
|
|
54 |
String encoding = "UTF-8"; |
|
55 |
if (propertyFile.getName().startsWith("bundle")) { |
|
56 |
encoding = "iso-8859-1"; |
|
57 |
} |
|
58 |
|
|
59 |
propertyFile.withWriter(encoding) { output -> |
|
48 | 60 |
props.store(output, "") |
49 | 61 |
} |
50 | 62 |
return true; |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/i18n/GetStringsFromPropertiesFile.groovy (revision 3905) | ||
---|---|---|
14 | 14 |
File oldNLSClassFile = new File(oldProjectMessagesPackage, "TBXMessages.java"); |
15 | 15 |
def langs = ["_fr", "", "_ru"] |
16 | 16 |
for (def lang : langs) { |
17 |
|
|
17 | 18 |
println "LANG=$lang" |
18 | 19 |
Properties oldProperties = new Properties(); |
19 | 20 |
File oldMessageFile = new File(oldProjectMessagesPackage, "messages${lang}.properties") |
20 | 21 |
oldProperties.load(IOUtils.getReader(oldMessageFile, "UTF-8")); |
21 | 22 |
Properties newProperties = new Properties(); |
22 | 23 |
File newMessageFile = new File(newProjectMessagesPackage, "messages${lang}.properties") |
23 |
if (newMessageFile.exists()) |
|
24 |
if (newMessageFile.exists()) {
|
|
24 | 25 |
newProperties.load(IOUtils.getReader(newMessageFile, "UTF-8")); |
25 |
|
|
26 |
} |
|
27 |
|
|
26 | 28 |
newNLSClassFile.getText("UTF-8").findAll("public static String [^;]+;") { key -> |
27 | 29 |
key = key.substring(21, key.length()-1) |
28 | 30 |
|
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/CreateTranslateProject.java (revision 3905) | ||
---|---|---|
120 | 120 |
IPath path = new Path(Toolbox.getInstallDirectory()+"/plugins"); |
121 | 121 |
srcFolder.createLink(path, IResource.ALLOW_MISSING_LOCAL, cpb); |
122 | 122 |
|
123 |
// set the encoding bundle=iso-8859-1, messages=utf-8
|
|
123 |
// set the encoding bundle=UTF-8, messages=utf-8
|
|
124 | 124 |
ArrayList<IResource> propertiesFiles = new ArrayList<IResource>(); |
125 | 125 |
ExportTranslateProject.findPropertiesFile(srcFolder, propertiesFiles); |
126 | 126 |
for (IResource e : propertiesFiles) { |
TXM/trunk/bundles/org.txm.translate.rcp/src/org/txm/rcp/translate/ExternalizationFilesUpdater.java (revision 3905) | ||
---|---|---|
90 | 90 |
*/ |
91 | 91 |
public static List<String> getEntries(File file) throws IOException { |
92 | 92 |
List<String> entries = new ArrayList<>(); |
93 |
String encoding = "iso-8859-1";
|
|
94 |
if (file.getName().startsWith("message")) { // TXM manages messages.properties encoded in UTF-8
|
|
95 |
encoding = "UTF-8";
|
|
93 |
String encoding = "UTF-8";
|
|
94 |
if (file.getName().startsWith("bundle")) { // TXM manages messages.properties encoded in UTF-8
|
|
95 |
encoding = "iso-8859-1";
|
|
96 | 96 |
} |
97 | 97 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); |
98 | 98 |
String line = reader.readLine(); |
... | ... | |
118 | 118 |
public static HashMap<String, String> getValues(File file) throws IOException { |
119 | 119 |
HashMap<String, String> values = new HashMap<>(); |
120 | 120 |
|
121 |
String encoding = "iso-8859-1";
|
|
122 |
if (file.getName().startsWith("message")) { // TXM manages messages.properties encoded in UTF-8
|
|
123 |
encoding = "UTF-8";
|
|
121 |
String encoding = "UTF-8";
|
|
122 |
if (file.getName().startsWith("bundle")) { // TXM manages messages.properties encoded in UTF-8
|
|
123 |
encoding = "iso-8859-1";
|
|
124 | 124 |
} |
125 | 125 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); |
126 | 126 |
|
... | ... | |
200 | 200 |
if (debug) System.out.println(" U " + f + " <- " + entries); |
201 | 201 |
HashMap<String, String> values = this.fileentriesvalues.get(f); |
202 | 202 |
|
203 |
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(f), "iso-8859-1");
|
|
203 |
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(f), "UTF-8");
|
|
204 | 204 |
for (String entry : entries) { |
205 | 205 |
writer.write(entry + "=" + values.get(entry) + "\n"); |
206 | 206 |
} |
Formats disponibles : Unified diff