Révision 1355

tmp/org.txm.utils/src/org/txm/utils/io/IOUtils.java (revision 1355)
19 19
import java.util.regex.Matcher;
20 20
import java.util.regex.Pattern;
21 21

  
22
import org.eclipse.osgi.util.NLS;
22 23
import org.txm.utils.i18n.DetectBOM;
23 24

  
24 25
public class IOUtils {
25
	public static final String UTF8 = "UTF-8";
26
	
27
	public static final String UTF8 = "UTF-8"; //$NON-NLS-1$
26 28

  
27 29
	public static ArrayList<String> findWithGroup(File file, String pattern) throws IOException {
28 30
		return findWithGroup(file, UTF8, pattern, false);
......
40 42
		ArrayList<String> matches = new ArrayList<String>();
41 43
		String text = IOUtils.getText(file, encoding);
42 44
		if (normalizeSeparators) {
43
			text = text.replaceAll("\\s", " ");
44
			text = text.replaceAll("\\t", " ");
45
			text = text.replaceAll("\\n", " ");
46
			text = text.replaceAll("[ ]+", " ");
45
			text = text.replaceAll("\\s", " "); //$NON-NLS-1$
46
			text = text.replaceAll("\\t", " "); //$NON-NLS-1$
47
			text = text.replaceAll("\\n", " "); //$NON-NLS-1$
48
			text = text.replaceAll("[ ]+", " "); //$NON-NLS-1$
47 49
		}
48 50
		
49 51
		Pattern test = Pattern.compile(pattern);
......
71 73
		String text = IOUtils.getText(file, encoding);
72 74
		//System.out.println(text);
73 75
		if (normalizeSeparators) {
74
			text = text.replaceAll("\\s", " ");
75
			text = text.replaceAll("\\t", " ");
76
			text = text.replaceAll("\\n", " ");
77
			text = text.replaceAll("[ ]+", " ");
76
			text = text.replaceAll("\\s", " "); //$NON-NLS-1$ //$NON-NLS-2$
77
			text = text.replaceAll("\\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
78
			text = text.replaceAll("\\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
79
			text = text.replaceAll("[ ]+", " "); //$NON-NLS-1$ //$NON-NLS-2$
78 80
		}
79 81
		
80 82
		Pattern test = Pattern.compile(pattern);
......
98 100
			} catch (IOException e) {
99 101
				e.printStackTrace();
100 102
			}
101
		return new BufferedReader(new InputStreamReader(input , "UTF-8")); //$NON-NLS-1$
103
		return new BufferedReader(new InputStreamReader(input , UTF8));
102 104
	}
103 105

  
104 106
	public static BufferedReader getReader(String file) throws UnsupportedEncodingException, FileNotFoundException {
......
111 113

  
112 114
	public static BufferedReader getReader(URL url, String encoding) throws IOException {
113 115
		InputStream inputStream = url.openConnection().getInputStream();
114
		return new BufferedReader(new InputStreamReader(inputStream , "UTF-8")); //$NON-NLS-1$
116
		return new BufferedReader(new InputStreamReader(inputStream , UTF8));
115 117
	}
116 118

  
117 119
	public static void setText(File file, String text, String encoding) throws IOException {
......
128 130
			while (line != null) {
129 131
				builder.append(line);
130 132
				line = reader.readLine();
131
				if (line != null) builder.append("\n");
133
				if (line != null) builder.append("\n"); //$NON-NLS-1$
132 134
			}
133 135
		} finally {
134 136
			reader.close();
......
144 146
			while (line != null) {
145 147
				builder.append(line);
146 148
				line = reader.readLine();
147
				if (line != null) builder.append("\n");
149
				if (line != null) builder.append("\n"); //$NON-NLS-1$
148 150
			}
149 151
		} finally {
150 152
			reader.close();
......
161 163
	}
162 164

  
163 165
	public static PrintWriter getWriter(File file, boolean append) throws UnsupportedEncodingException, FileNotFoundException {
164
		return getWriter(file, "UTF-8", append);
166
		return getWriter(file, UTF8, append);
165 167
	}
166 168

  
167 169
	public static PrintWriter getWriter(File file, String encoding, boolean append) throws UnsupportedEncodingException, FileNotFoundException {
168
		return new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file, append)) , "UTF-8")); //$NON-NLS-1$
170
		return new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file, append)) , UTF8));
169 171
	}
170 172

  
171 173
	public static PrintWriter getWriter(String file) throws UnsupportedEncodingException, FileNotFoundException {
......
190 192
			}
191 193
			reader.close();
192 194
		} catch(Exception e) {
193
			System.out.println("Error while getting lines: "+e.getLocalizedMessage());
195
			System.err.println(NLS.bind("Error while getting lines: {0}.", e.getLocalizedMessage()));
194 196
		}
195 197
		return lines;
196 198
	}
......
208 210
	}
209 211

  
210 212
	public static void replace(File file, String oldString, String newString) throws IOException {
211
		String text = getText(file, "UTF-8");
213
		String text = getText(file, UTF8);
212 214
		text = text.replace(oldString, newString);
213 215
		IOUtils.write(file, text);
214 216
	}
215 217
	
216 218
	public static void replaceAll(File file, Pattern regex, String newString) throws IOException {
217
		String text = getText(file, "UTF-8");
219
		String text = getText(file, UTF8);
218 220
		text = regex.matcher(text).replaceAll(newString);
219 221
		IOUtils.write(file, text);
220 222
	}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages.properties (revision 1355)
1
#TXM messages generated by the PluginMessagesManager class
2
#Mon Nov 12 17:18:22 CET 2018
3
addingAlignmentAttributeToCorpusP0RegistryDDotP1=Adding Alignment attribute to corpus {0} registry\: {1}...
4
b2=b2 
5
cantFindCQPLocationDDot=** Can't find CQP location \: 
6
cantFindRegistryFile=Can't find registry file
7
cLErrorDDot=CL error\: 
8
clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12DDot=client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) \: 
9
connectedToTheSearchEngine=Connected to the Search Engine.
10
connectingToTheSearchEngineWithTheFollowingParametersDDotP0DDotP1AtP2P3=Connecting to the Search Engine with the following parameters\: {0}\:{1}@{2}{3}...
11
couldNotBeFoundInRegistryFile=could not be found in registry file 
12
couldNotPatchTheRegistryFile=Could not patch the 'registry' file.
13
couldNotReconnectToServerDDot=Could not reconnect to server\: 
14
cQPErrorDDot=CQP error\: 
15
cqpserverStderrDDot=** cqpserver stderr\: 
16
cqpserverStdoutDDot=** cqpserver stdout\: 
17
dataDirectory=data directory 
18
encodingTo=encoding to 
19
errorDDotEditionDefaultIsNull=Error \: edition default is null
20
errorDDotTextidsP0AndWordidsP1=Error\: textids {0} and wordids {1}.
21
errorDDotTextP0IsNull=Error\: text {0} is null.
22
failedToConnectToSearchEngine=** failed to connect to Search Engine.
23
fixingRegistryFileP0WithP1=Fixing registry file {0} with {1}.
24
gettingLastCQPError=Getting Last CQP error.
25
internalCQIErrorDDot=Internal CQI error\: 
26
lastCQiErrorDDot=Last CQi error\: 
27
lastCQPErrorDDot=Last CQP error\: 
28
noError=No error.
29
p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters={0} is not a valid CQP ID for a subcorpus. It must be an uppercase character followed by lowercase characters.
30
processingCorpus=Processing corpus...
31
processStopedDDot=Process stoped\: 
32
queryError=Query error
33
readBooleanFromTheCQiServerDDotP0=Read boolean from the CQi server\: {0}.
34
readByteFromTheCQiServerDDotP0=Read byte from the CQi server\: {0}.
35
readingAnIntegerTableFromTheCQiServer=Reading an integer table from the CQi server...
36
readingBooleanFromTheCQiServer=Reading boolean from the CQi server...
37
readingHeaderFromTheCQiServer=Reading header from the CQi server...
38
readingIntegerArrayFromTheCQiServer=Reading integer array from the CQi server...
39
readingIntegerFromTheCQiServer=Reading integer from the CQi server...
40
readingStringArrayFromTheCQiServer=Reading string array from the CQi server...
41
readingStringFromTheCQiServer=Reading string from the CQi server...
42
readIntegerArrayFromTheCQiServerDDotP0=Read integer array from the CQi server\: {0}.
43
readIntegerFromTheCQiServerDDotP0=Read integer from the CQi server\: {0}.
44
readString2DIntegerFromTheCQiServerDDotP0=Read string 2D integer from the CQi server\: {0}.
45
readStringArrayFromTheCQiServerDDotP0=Read string array from the CQi server\: {0}.
46
readStringFromTheCQiServerDDotP0=Read string from the CQi server\: {0}.
47
searchEngineLaunched=Search Engine launched...
48
sourceRegistryDoesNotExistsDDot=Source registry does not exists\: 
49
startingProcessWithCommandDDot=Starting process with command\: 
50
stoppingProcessDDot=Stopping process\: 
51
theBinaryDirectoryDoesNotExistsDDot=The "binary" directory does not exists\: 
52
theCorporaDirectoryDoesNotExistsDDot=The "corpora" directory does not exists\: 
53
theDataDirectoryDoesNotExistsDDot=The "data" directory does not exists\: 
54
theDirectoryDoesNotExistsDDot=The directory does not exists\: 
55
theFileP0CannotBeFound=The file ''{0}'' cannot be found.
56
theRegistryDirectoryDoesNotExistsDDot=The "registry" directory does not exists\:  
57
theTargetCorpusDoesntExist=** The target corpus doesn't exist
58
unknownCQPCodeDDotB1=Unknown CQP code\: b1 
59
unknownCQPCodesDDotB1=Unknown CQP codes\: b1 
60
unknownCQPCQIErrorDDotB1=Unknown CQP CQI error\: b1 
61
unknownCQPErrorDDotB1=Unknown CQP error\: b1 
62
updating=Updating 
63
updatingP0CorpusLanguageToP1=Updating {0} corpus language to {1}...
1
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
2
#TXM messages generated by the PluginMessagesManager class
3
#Mon Nov 12 17:18:22 CET 2018
4

  
5
addingAlignmentAttributeToCorpusP0RegistryDDotP1 = Adding Alignment attribute to corpus {0} registry: {1}...
6

  
7
b2 = b2 
8

  
9
cLErrorDDot = CL error: 
10

  
11
cQPErrorDDot = CQP error: 
12

  
13
cantFindCQPLocationDDot = ** Can't find CQP location : 
14

  
15
cantFindRegistryFile = Can't find registry file
16

  
17
clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12DDot = client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) : 
18

  
19
connectedToTheSearchEngine = Connected to the Search Engine.
20

  
21
connectingToTheSearchEngineWithTheFollowingParametersDDotP0DDotP1AtP2P3 = Connecting to the Search Engine with the following parameters: {0}:{1}@{2}{3}...
22

  
23
couldNotBeFoundInRegistryFile = could not be found in registry file 
24

  
25
couldNotPatchTheRegistryFile = Could not patch the 'registry' file.
26

  
27
couldNotReconnectToServerDDot = Could not reconnect to server: 
28

  
29
cqpserverStderrDDot = ** cqpserver stderr: 
30

  
31
cqpserverStdoutDDot = ** cqpserver stdout: 
32

  
33
dataDirectory = data directory 
34

  
35
encodingTo = encoding to 
36

  
37
errorDDotEditionDefaultIsNull = Error : edition default is null
38

  
39
errorDDotTextP0IsNull = Error: text {0} is null.
40

  
41
errorDDotTextidsP0AndWordidsP1 = Error: textids {0} and wordids {1}.
42

  
43
failedToConnectToSearchEngine = ** failed to connect to Search Engine.
44

  
45
fixingRegistryFileP0WithP1 = Fixing registry file {0} with {1}.
46

  
47
gettingLastCQPError = Getting Last CQP error.
48

  
49
internalCQIErrorDDot = Internal CQI error: 
50

  
51
lastCQPErrorDDot = Last CQP error: 
52

  
53
lastCQiErrorDDot = Last CQi error: 
54

  
55
noError = No error.
56

  
57
p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters = {0} is not a valid CQP ID for a subcorpus. It must be an uppercase character followed by lowercase characters.
58

  
59
processStopedDDot = Process stoped: 
60

  
61
processingCorpus = Processing corpus "{0}"...
62

  
63
queryError = Query error
64

  
65
readBooleanFromTheCQiServerDDotP0 = Read boolean from the CQi server: {0}.
66

  
67
readByteFromTheCQiServerDDotP0 = Read byte from the CQi server: {0}.
68

  
69
readIntegerArrayFromTheCQiServerDDotP0 = Read integer array from the CQi server: {0}.
70

  
71
readIntegerFromTheCQiServerDDotP0 = Read integer from the CQi server: {0}.
72

  
73
readString2DIntegerFromTheCQiServerDDotP0 = Read string 2D integer from the CQi server: {0}.
74

  
75
readStringArrayFromTheCQiServerDDotP0 = Read string array from the CQi server: {0}.
76

  
77
readStringFromTheCQiServerDDotP0 = Read string from the CQi server: {0}.
78

  
79
readingAnIntegerTableFromTheCQiServer = Reading an integer table from the CQi server...
80

  
81
readingBooleanFromTheCQiServer = Reading boolean from the CQi server...
82

  
83
readingHeaderFromTheCQiServer = Reading header from the CQi server...
84

  
85
readingIntegerArrayFromTheCQiServer = Reading integer array from the CQi server...
86

  
87
readingIntegerFromTheCQiServer = Reading integer from the CQi server...
88

  
89
readingStringArrayFromTheCQiServer = Reading string array from the CQi server...
90

  
91
readingStringFromTheCQiServer = Reading string from the CQi server...
92

  
93
searchEngineLaunched = Search Engine launched...
94

  
95
sourceRegistryDoesNotExistsDDot = Source registry does not exists: 
96

  
97
startingProcessWithCommandDDot = Starting process with command: 
98

  
99
stoppingProcessDDot = Stopping process: 
100

  
101
theBinaryDirectoryDoesNotExistsDDot = The "bin" directory does not exists: {0}.
102

  
103
theCorporaDirectoryDoesNotExistsDDot = The "corpora" directory does not exists: {0}.
104

  
105
theDataDirectoryDoesNotExistsDDot = The "data" directory does not exists: {0}.
106

  
107
theDirectoryDoesNotExistsDDot = The directory does not exist: {0}.
108

  
109
theFileP0CannotBeFound = The file "{0}" can not be found.
110

  
111
theRegistryDirectoryDoesNotExistsDDot = The "registry" directory does not exists: {0}.  
112

  
113
theTargetCorpusDoesntExist = ** The target corpus doesn't exist.
114

  
115
unknownCQPCQIErrorDDotB1 = Unknown CQP CQI error: b1 
116

  
117
unknownCQPCodeDDotB1 = Unknown CQP code: b1 
118

  
119
unknownCQPCodesDDotB1 = Unknown CQP codes: b1 
120

  
121
unknownCQPErrorDDotB1 = Unknown CQP error: b1 
122

  
123
updating = Updating 
124

  
125
updatingP0CorpusLanguageToP1 = Updating {0} corpus language to {1}...
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/messages/messages_fr.properties (revision 1355)
1
#TXM messages generated by the PluginMessagesManager class
2
#Mon Nov 12 17:18:22 CET 2018
3
addingAlignmentAttributeToCorpusP0RegistryDDotP1=Ajout au registre du corpus {0} de l'attribut d'alignement \: {1}...
4
b2=b2 
5
cantFindCQPLocationDDot=** Echec de localisation de CQP \: 
6
cantFindRegistryFile=Le fichier 'registry' est introuvable
7
cLErrorDDot=Erreur CQ \:
8
clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12DDot=client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) \: 
9
connectedToTheSearchEngine=Connexion au moteur de recherche établie.
10
connectingToTheSearchEngineWithTheFollowingParametersDDotP0DDotP1AtP2P3=Connexion au moteur de recherche avec les paramètres suivants \: {0}\:{1}@{2}{3}...
11
couldNotBeFoundInRegistryFile=n'a pu être trouvé dans 
12
couldNotPatchTheRegistryFile=Erreur lors de la reécriture du fichier 'registry'.
13
couldNotReconnectToServerDDot=Echec de la reconnexion au serveur \: 
14
cQPErrorDDot=Erreur CQP \: 
15
cqpserverStderrDDot=** cqpserver stderr\: 
16
cqpserverStdoutDDot=** cqpserver stdout\: 
17
dataDirectory=dossier 'data'
18
encodingTo=pour l'encodage 
19
errorDDotEditionDefaultIsNull=Erreur \: edition a pour valeur 'null'
20
errorDDotTextidsP0AndWordidsP1=Erreur \: textids {0} et wordids {1}.
21
errorDDotTextP0IsNull=Erreur \: text {0} a pour valeur 'null'.
22
failedToConnectToSearchEngine=** La connexion au moteur de recherche a échoué.
23
fixingRegistryFileP0WithP1=Patche du fichier registry {0} avec {1}.
24
gettingLastCQPError=Récupération de la dernière erreur CQP.
25
internalCQIErrorDDot=Erreur interne CQI \: 
26
lastCQiErrorDDot=Dernière erreur CQi \: 
27
lastCQPErrorDDot=Dernière erreur CQP \: 
28
noError=Pas d'erreur à notifier.
29
p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters={0} n'est pas un identifiant de sous-corpus CQP valide. Il doit être en majuscules suivies de caractères minuscules.
30
processingCorpus=Traitement du corpus...
31
processStopedDDot=Processus arrêté \: 
32
queryError=Erreur de requête
33
readBooleanFromTheCQiServerDDotP0=Booléen reçu du serveur CQi \: {0}.
34
readByteFromTheCQiServerDDotP0=Octet reçu du serveur CQi \: {0}.
35
readingAnIntegerTableFromTheCQiServer=Lecture d''un tableau d'entiers du serveur CQi...
36
readingBooleanFromTheCQiServer=Lecture d''un booléen du serveur CQi...
37
readingHeaderFromTheCQiServer=Lecture d''une entête du serveur CQi...
38
readingIntegerArrayFromTheCQiServer=Lecture d''un tableau d'entiers du serveur CQi...
39
readingIntegerFromTheCQiServer=Lecture d''un entier du serveur CQi...
40
readingStringArrayFromTheCQiServer=Lecture d''un tableau de chaines du serveur CQi...
41
readingStringFromTheCQiServer=Lecture d''une chaine du serveur CQi...
42
readIntegerArrayFromTheCQiServerDDotP0=Tableau d''entiers reçu du serveur CQi \: {0}.
43
readIntegerFromTheCQiServerDDotP0=Entier reçu du serveur CQi \: {0}.
44
readString2DIntegerFromTheCQiServerDDotP0=Tableau d''entiers reçu du serveur CQi \: {0}.
45
readStringArrayFromTheCQiServerDDotP0=Tableau de chaines reçu du serveur CQi \: {0}.
46
readStringFromTheCQiServerDDotP0=Chaîne reçue du serveur CQi \: {0}.
47
searchEngineLaunched=Moteur de recherche lancé...
48
sourceRegistryDoesNotExistsDDot=Le fichier registry source n'existe pas
49
startingProcessWithCommandDDot=Démarrage du processus avec la ligne de commande \: 
50
stoppingProcessDDot=Arrêt en cours du processus \: 
51
theBinaryDirectoryDoesNotExistsDDot=Le dossier "bin" n'existe pas \: 
52
theCorporaDirectoryDoesNotExistsDDot=Le dossier "corpora" n'existe pas \:
53
theDataDirectoryDoesNotExistsDDot=Le dossier "data" n'existe pas \:
54
theDirectoryDoesNotExistsDDot=Le dossier n'existe pas \:
55
theFileP0CannotBeFound=Le fichier ''{0}'' est introuvable.
56
theRegistryDirectoryDoesNotExistsDDot=Le dossier "registry" n'existe pas \: 
57
theTargetCorpusDoesntExist=** Le corpus cible n'existe pas
58
unknownCQPCodeDDotB1=Code CQP inconnu \: b1 
59
unknownCQPCodesDDotB1=Codes CQP inconnus \: b1 
60
unknownCQPCQIErrorDDotB1=Erreur CQP CQI inconnue \: b1 
61
unknownCQPErrorDDotB1=Erreur CQP inconnue \: b1 
62
updating=Mise à jour du corpus 
63
updatingP0CorpusLanguageToP1=Mise à jour de la langue du corpus {0} vers {1}...
1
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
2
#TXM messages generated by the PluginMessagesManager class
3
#Mon Nov 12 17:18:22 CET 2018
4

  
5
addingAlignmentAttributeToCorpusP0RegistryDDotP1 = Ajout au registre du corpus {0} de l'attribut d'alignement : {1}...
6

  
7
b2 = b2 
8

  
9
cLErrorDDot = Erreur CQ :
10

  
11
cQPErrorDDot = Erreur CQP : 
12

  
13
cantFindCQPLocationDDot = ** Echec de localisation de CQP : 
14

  
15
cantFindRegistryFile = Le fichier 'registry' est introuvable
16

  
17
clientdumpSubCorpussubcorpusNetCqiClientCQICONSTFIELDMATCH12DDot = client.dumpSubCorpus(subcorpus, NetCqiClient.CQI_CONST_FIELD_MATCH, 1, 2) : 
18

  
19
connectedToTheSearchEngine = Connexion au moteur de recherche établie.
20

  
21
connectingToTheSearchEngineWithTheFollowingParametersDDotP0DDotP1AtP2P3 = Connexion au moteur de recherche avec les paramètres suivants : {0}:{1}@{2}{3}...
22

  
23
couldNotBeFoundInRegistryFile = n'a pu être trouvé dans 
24

  
25
couldNotPatchTheRegistryFile = Erreur lors de la reécriture du fichier 'registry'.
26

  
27
couldNotReconnectToServerDDot = Echec de la reconnexion au serveur : 
28

  
29
cqpserverStderrDDot = ** cqpserver stderr: 
30

  
31
cqpserverStdoutDDot = ** cqpserver stdout: 
32

  
33
dataDirectory = dossier 'data'
34

  
35
encodingTo = pour l'encodage 
36

  
37
errorDDotEditionDefaultIsNull = Erreur : edition a pour valeur 'null'
38

  
39
errorDDotTextP0IsNull = Erreur : text {0} a pour valeur 'null'.
40

  
41
errorDDotTextidsP0AndWordidsP1 = Erreur : textids {0} et wordids {1}.
42

  
43
failedToConnectToSearchEngine = ** La connexion au moteur de recherche a échoué.
44

  
45
fixingRegistryFileP0WithP1 = Patchage du fichier registry {0} avec {1}.
46

  
47
gettingLastCQPError = Récupération de la dernière erreur CQP.
48

  
49
internalCQIErrorDDot = Erreur interne CQI : 
50

  
51
lastCQPErrorDDot = Dernière erreur CQP : 
52

  
53
lastCQiErrorDDot = Dernière erreur CQi : 
54

  
55
noError = Pas d'erreur à notifier.
56

  
57
p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters = {0} n'est pas un identifiant de sous-corpus CQP valide. Il doit être en majuscules suivies de caractères minuscules.
58

  
59
processStopedDDot = Processus arrêté : 
60

  
61
processingCorpus = Traitement du corpus "{0}"...
62

  
63
queryError = Erreur de requête
64

  
65
readBooleanFromTheCQiServerDDotP0 = Booléen reçu du serveur CQi : {0}.
66

  
67
readByteFromTheCQiServerDDotP0 = Octet reçu du serveur CQi : {0}.
68

  
69
readIntegerArrayFromTheCQiServerDDotP0 = Tableau d''entiers reçu du serveur CQi : {0}.
70

  
71
readIntegerFromTheCQiServerDDotP0 = Entier reçu du serveur CQi : {0}.
72

  
73
readString2DIntegerFromTheCQiServerDDotP0 = Tableau d''entiers reçu du serveur CQi : {0}.
74

  
75
readStringArrayFromTheCQiServerDDotP0 = Tableau de chaines reçu du serveur CQi : {0}.
76

  
77
readStringFromTheCQiServerDDotP0 = Chaîne reçue du serveur CQi : {0}.
78

  
79
readingAnIntegerTableFromTheCQiServer = Lecture d''un tableau d'entiers du serveur CQi...
80

  
81
readingBooleanFromTheCQiServer = Lecture d''un booléen du serveur CQi...
82

  
83
readingHeaderFromTheCQiServer = Lecture d''une entête du serveur CQi...
84

  
85
readingIntegerArrayFromTheCQiServer = Lecture d''un tableau d'entiers du serveur CQi...
86

  
87
readingIntegerFromTheCQiServer = Lecture d''un entier du serveur CQi...
88

  
89
readingStringArrayFromTheCQiServer = Lecture d''un tableau de chaines du serveur CQi...
90

  
91
readingStringFromTheCQiServer = Lecture d''une chaine du serveur CQi...
92

  
93
searchEngineLaunched = Moteur de recherche lancé...
94

  
95
sourceRegistryDoesNotExistsDDot = Le fichier registry source n'existe pas
96

  
97
startingProcessWithCommandDDot = Démarrage du processus avec la ligne de commande : 
98

  
99
stoppingProcessDDot = Arrêt en cours du processus : 
100

  
101
theBinaryDirectoryDoesNotExistsDDot = Le dossier "bin" n'existe pas : {0}.
102

  
103
theCorporaDirectoryDoesNotExistsDDot = Le dossier "corpora" n'existe pas : {0}.
104

  
105
theDataDirectoryDoesNotExistsDDot = Le dossier "data" n'existe pas : {0}.
106

  
107
theDirectoryDoesNotExistsDDot = Le dossier n'existe pas : {0}.
108

  
109
theFileP0CannotBeFound = Le fichier "{0}" est introuvable.
110

  
111
theRegistryDirectoryDoesNotExistsDDot = Le dossier "registry" n'existe pas : {0}.
112

  
113
theTargetCorpusDoesntExist = ** Le corpus cible n'existe pas.
114

  
115
unknownCQPCQIErrorDDotB1 = Erreur CQP CQI inconnue : b1 
116

  
117
unknownCQPCodeDDotB1 = Code CQP inconnu : b1 
118

  
119
unknownCQPCodesDDotB1 = Codes CQP inconnus : b1 
120

  
121
unknownCQPErrorDDotB1 = Erreur CQP inconnue : b1 
122

  
123
updating = Mise à jour du corpus 
124

  
125
updatingP0CorpusLanguageToP1 = Mise à jour de la langue du corpus {0} vers {1}...
tmp/org.txm.searchengine.cqp.core/src/org/txm/importer/cwb/CwbEncode.java (revision 1355)
36 36

  
37 37
import org.eclipse.osgi.util.NLS;
38 38
import org.txm.Toolbox;
39
import org.txm.core.messages.TXMCoreMessages;
39 40
import org.txm.core.preferences.TBXPreferences;
40 41
import org.txm.libs.cqp.CQPLibPreferences;
41 42
import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
......
107 108
			String[] sAttributes, boolean monitorOutput) throws ServerNotFoundException, InterruptedException, IOException {
108 109
		
109 110
		File pathToExecutable = new File(CQPLibPreferences.getInstance().getString(CQPLibPreferences.CQI_SERVER_PATH_TO_CQPLIB),
110
				"cwb-encode"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":""));
111
				"cwb-encode"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
111 112

  
112 113
		return run(pathToExecutable.getAbsolutePath(), pathToData, inputFile,
113 114
				pathToRegistry, pAttributes, sAttributes, false);
......
118 119
	 * @return if the cwb-encode executable file set in preferences is available 
119 120
	 */
120 121
	public static boolean isExecutableAvailable() {
121
		return isExecutableAvailable("cwb-encode"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":""));
122
		return isExecutableAvailable("cwb-encode"+(System.getProperty("os.name").toLowerCase().contains("windows")?".exe":"")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
122 123
	}
123 124
	
124 125
	/**
......
138 139
	public boolean run(String pathToExecutable, String pathToData,
139 140
			List<File> inputFiles, String pathToRegistry, String[] pAttributes,
140 141
			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
141
		boolean ret = run(pathToExecutable, pathToData, inputFiles,
142
				pathToRegistry, pAttributes, sAttributes, false);
142
		boolean ret = run(pathToExecutable, pathToData, inputFiles, pathToRegistry, pAttributes, sAttributes, false);
143 143

  
144 144
		return ret;
145 145
	}
......
161 161
	public boolean run(String pathToExecutable, String pathToData,
162 162
			String inputFile, String pathToRegistry, String[] pAttributes,
163 163
			String[] sAttributes) throws ServerNotFoundException, InterruptedException, IOException {
164
		boolean ret = run(pathToExecutable, pathToData, inputFile,
165
				pathToRegistry, pAttributes, sAttributes, false);
164
		boolean ret = run(pathToExecutable, pathToData, inputFile, pathToRegistry, pAttributes, sAttributes, false);
166 165

  
167 166
		return ret;
168 167
	}
......
222 221
		deleteDir(data);
223 222
		data.mkdirs();
224 223

  
225
		if (pathToRegistry.startsWith("\\\\")) pathToRegistry = pathToRegistry.replace("\\\\", "//"); // fix UNC paths for mingw
226
		if (pathToData.startsWith("\\\\")) pathToData = pathToData.replace("\\\\", "//"); // fix UNC paths for mingw
227

  
224
		// fix UNC paths for mingw
225
		if (pathToRegistry.startsWith("\\\\")) {
226
			pathToRegistry = pathToRegistry.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
227
		}
228
		// fix UNC paths for mingw 
229
		if (pathToData.startsWith("\\\\")) {
230
			pathToData = pathToData.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
231
		}
228 232
		
229 233
		if (!new File(pathToExecutable).exists()) {
230
			System.out.println("Error: path to cwb-encode not found: "+pathToExecutable);
234
			System.err.println(TXMCoreMessages.bind("Error: path to cwb-encode not found: {0}.", pathToExecutable));
231 235
			return false;
232 236
		}
233 237
		if (!new File(pathToExecutable).canExecute()) {
234
			System.out.println("Error: path to cwb-encode not executable: "+pathToExecutable);
238
			System.err.println(TXMCoreMessages.bind("Error: path to cwb-encode not executable: {0}.", pathToExecutable));
235 239
			return false;
236 240
		}
237 241
		
......
245 249
		// Warning !! for WINDOWS ONLY the "" value does not work with the ProcessBuilder we must set the value to "\"\""
246 250
		String empty_value_code = Toolbox.getPreference(TBXPreferences.EMPTY_PROPERTY_VALUE_CODE);
247 251
		if (OSDetector.isFamilyWindows()) {
248
			if (empty_value_code == null) empty_value_code = "\"\"";
252
			if (empty_value_code == null) empty_value_code = "\"\"";//$NON-NLS-1$
249 253
			empty_value_code = empty_value_code.trim();
250
			if (empty_value_code.length() == 0) empty_value_code = "\"\"";
254
			if (empty_value_code.length() == 0) empty_value_code = "\"\"";//$NON-NLS-1$
251 255
		}
252 256

  
253 257
		ArrayList<String> cmd = new ArrayList<String>();
254 258
		if (inputFiles != null) { //read input from file
255 259
			cmd.add(pathToExecutable);
256
			cmd.add("-d");
257
			cmd.add(new File(pathToData).getAbsolutePath()); //$NON-NLS-1$
260
			cmd.add("-d");//$NON-NLS-1$
261
			cmd.add(new File(pathToData).getAbsolutePath());
258 262
			cmd.add("-R"); //$NON-NLS-1$
259 263
			cmd.add(new File(pathToRegistry).getAbsolutePath()); 
260
			cmd.add("-U");
261
			cmd.add(empty_value_code); //$NON-NLS-1$ //$NON-NLS-2$
264
			cmd.add("-U");//$NON-NLS-1$
265
			cmd.add(empty_value_code);
262 266
			cmd.add("-c"); //$NON-NLS-1$
263
			cmd.add("utf8"); //$NON-NLS-1$ //$NON-NLS-2$
267
			cmd.add("utf8"); //$NON-NLS-1$
264 268

  
265 269
			if (debug) {
266 270
				cmd.add("-D"); //$NON-NLS-1$ 
......
274 278
			String[] c = { pathToExecutable,
275 279
					"-d", new File(pathToData).getAbsolutePath() //$NON-NLS-1$
276 280
					, "-R", new File(pathToRegistry).getAbsolutePath() //$NON-NLS-1$
277
					, "-U", empty_value_code //$NON-NLS-1$ //$NON-NLS-2$
281
					, "-U", empty_value_code //$NON-NLS-1$
278 282
					, "-c", "utf8" //$NON-NLS-1$ //$NON-NLS-2$
279 283
					//, "-x" //$NON-NLS-1$ 
280 284
			}; 
281 285
			cmd.addAll(Arrays.asList(c));
282 286
		}
283 287

  
284
		cmd.add("-xsB"); //$NON-NLS-1$ //$NON-NLS-2$
288
		cmd.add("-xsB"); //$NON-NLS-1$
285 289
		for (int i = 0; i < pAttributes.length; i++) {
286 290
			cmd.add("-P"); //$NON-NLS-1$
287 291
			// lower case pattributes
......
308 312
		File registry = new File(directory, "registry"); //$NON-NLS-1$
309 313
		File corpora = new File(directory, "corpora"); //$NON-NLS-1$
310 314
		if (!directory.exists()) {
311
			System.err.println(CQPSearchEngineCoreMessages.theDirectoryDoesNotExistsDDot + directory);
315
			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theDirectoryDoesNotExistsDDot, directory));
312 316
			return;
313 317
		}
314 318
		if (!bin.exists()) {
315
			System.err.println(CQPSearchEngineCoreMessages.theBinaryDirectoryDoesNotExistsDDot + bin);
319
			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theBinaryDirectoryDoesNotExistsDDot, bin));
316 320
			return;
317 321
		}
318 322
		if (!registry.exists()) {
319
			System.err.println(CQPSearchEngineCoreMessages.theRegistryDirectoryDoesNotExistsDDot + registry);
323
			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theRegistryDirectoryDoesNotExistsDDot, registry));
320 324
			return;
321 325
		}
322 326
		if (!corpora.exists()) {
323
			System.err.println(CQPSearchEngineCoreMessages.theCorporaDirectoryDoesNotExistsDDot + corpora);
327
			System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theCorporaDirectoryDoesNotExistsDDot, corpora));
324 328
			return;
325 329
		}
326 330

  
327 331
		for (File corpus : corpora.listFiles()) {
328 332
			if (!corpus.isDirectory()) continue;
329 333
			
330
			System.out.println(CQPSearchEngineCoreMessages.processingCorpus + corpus.getName());
334
			System.out.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.processingCorpus, corpus.getName()));
331 335
			File data = new File(corpus, "data"); //$NON-NLS-1$
332 336

  
333 337
			if (!data.exists()) {
334
				System.err.println(CQPSearchEngineCoreMessages.theDataDirectoryDoesNotExistsDDot + data);
338
				System.err.println(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.theDataDirectoryDoesNotExistsDDot, data));
335 339
				return;
336 340
			}
337 341

  
338 342
			String datapath = data.getAbsolutePath();
339 343
			String regpath = registry.getAbsolutePath() + "/" + corpus.getName(); //$NON-NLS-1$
340
			if (datapath.startsWith("\\\\")) datapath = datapath.replace("\\\\", "//"); // fix UNC paths for mingw
344
			 // fix UNC paths for mingw
345
			if (datapath.startsWith("\\\\")) { //$NON-NLS-1$
346
				datapath = datapath.replace("\\\\", "//"); //$NON-NLS-1$ //$NON-NLS-2$
347
			}
341 348
			System.out.println(NLS.bind(CQPSearchEngineCoreMessages.fixingRegistryFileP0WithP1, regpath, datapath));
342 349
			try {
343 350
				PatchCwbRegistry.patch(new File(regpath), new File(datapath));
......
359 366
		PrintWriter output = IOUtils.getWriter(allcqpFile);
360 367
		ConsoleProgressBar cpb = new ConsoleProgressBar(cqpFiles.size());
361 368

  
362
		output.write("<txmcorpus lang=\"fr\">\n");
369
		output.write("<txmcorpus lang=\"fr\">\n"); //$NON-NLS-1$
363 370
		for (File cqpFile : cqpFiles) {
364 371
			cpb.tick();
365
			output.write(IOUtils.getText(cqpFile, "UTF-8"));
366
			output.write("\n");
372
			output.write(IOUtils.getText(cqpFile, "UTF-8")); //$NON-NLS-1$
373
			output.write("\n"); //$NON-NLS-1$
367 374
			output.flush();
368 375
		}
369
		output.write("</txmcorpus>\n");
376
		output.write("</txmcorpus>\n"); //$NON-NLS-1$
370 377
		output.close();
371 378
		return true;
372 379
	}
......
395 402
		 * (Exception ex) { System.out.println(ex);
396 403
		 * System.out.println(cwbEn.getErrorStream()); }
397 404
		 */
398
		CwbEncode.patchDir(new File(
399
				"C:/Documents and Settings/H/Mes documents/TXM/cwb")); //$NON-NLS-1$
405
		CwbEncode.patchDir(new File("C:/Documents and Settings/H/Mes documents/TXM/cwb")); //$NON-NLS-1$
400 406
	}
401 407
}

Formats disponibles : Unified diff