Revision 38967

View differences:

tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/dataset1/text.properties
1
#text.properties
2
aceptar=Aceptar
3
cancelar=Cancelar
4
Cascada=Cascada
5
cascada_enable=Debe haber al menos una ventana abierta
0 6

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/dataset1/text_en.properties
1
#text_en.properties
2
aceptar=OK
3
cancelar=Cancel
4
Cascada=Cascade
5
ventana=Window
6
otro=other
0 7

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/dataset1/text_fr.properties
1
#text_fr.properties
2
aceptar=Accepter
3
Cascada=Cascade
4
Configurar=Configurer
0 5

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/TestMessages.java
1
/**
2
 * 
3
 */
4
package org.gvsig.i18n;
5

  
6
import java.io.File;
7
import java.net.MalformedURLException;
8
import java.util.ArrayList;
9
import java.util.Locale;
10

  
11
import junit.framework.TestCase;
12

  
13
/**
14
 * @author cesar
15
 *
16
 */
17
public class TestMessages extends TestCase {
18

  
19
	/*
20
	 * @see TestCase#setUp()
21
	 */
22
	protected void setUp() throws Exception {
23
		super.setUp();
24
	}
25

  
26
	/*
27
	 * @see TestCase#tearDown()
28
	 */
29
	protected void tearDown() throws Exception {
30
		super.tearDown();
31
	}
32
	
33
	public void testSetPreferredLocales() {
34
		setPreferredLocales();
35
		removeLocales();
36
	}
37
	
38
	private void setPreferredLocales() {
39
		ArrayList preferred = new ArrayList();
40
		preferred.add(new Locale("en"));
41
		preferred.add(new Locale("es"));
42
		Messages.setPreferredLocales(preferred);
43
		ArrayList resultPref = Messages.getPreferredLocales();
44
		
45
		TestCase.assertEquals(resultPref.size(), 2);
46
		
47
		Locale lang1 = (Locale) resultPref.get(0);		
48
		TestCase.assertEquals(lang1.getLanguage(), "en");
49
		Locale lang2 = (Locale) resultPref.get(1);		
50
		TestCase.assertEquals(lang2.getLanguage(), "es");
51
	}
52

  
53
	private void removeLocales() {	
54
		Locale lang1 = new Locale("en");
55
		Locale lang2 = new Locale("es");	
56
		ArrayList resultPref = Messages.getPreferredLocales();
57
		Messages.removeLocale(lang1);
58
		TestCase.assertEquals(resultPref.size(), 1);
59
		Messages.removeLocale(lang2);		
60
		TestCase.assertEquals(resultPref.size(), 0);
61
	}
62
	
63
	public void testAddResourceFamily() {
64
		setPreferredLocales();
65
		//this.getClass().getClassLoader().getResource("text_en.properties");
66

  
67
		try {
68
			Messages.addResourceFamily("text", new File("src-test/org/gvsig/i18n/dataset1/"));
69
		} catch (MalformedURLException e) {
70
			TestCase.fail("Fichero de recursos no encontrado");
71
		}
72
		TestCase.assertEquals(5, Messages.size(new Locale("en")));
73
		TestCase.assertEquals(4,Messages.size(new Locale("es")));
74
		TestCase.assertEquals(0,Messages.size(new Locale("fr")));
75
		
76
		TestCase.assertEquals("OK", Messages.getText("aceptar"));
77
		TestCase.assertEquals("Cancel", Messages.getText("cancelar"));
78
		TestCase.assertEquals("Cascade", Messages.getText("Cascada"));
79
		TestCase.assertEquals("Window", Messages.getText("ventana"));
80
		TestCase.assertEquals("Debe haber al menos una ventana abierta", Messages.getText("cascada_enable"));
81
		TestCase.assertEquals("Configurar", Messages.getText("Configurar"));
82
		TestCase.assertEquals(null, Messages.getText("Configurar", false));
83

  
84
		// load another file now
85
		try {
86
			Messages.addResourceFamily("text", new File(
87
                    "src-test/org/gvsig/i18n/dataset2/"));
88
		} catch (MalformedURLException e) {
89
			TestCase.fail("Fichero de recursos no encontrado");
90
		}
91
		// check that the right amount of translations was loaded
92
		TestCase.assertEquals(7, Messages.size(new Locale("en")));
93
		TestCase.assertEquals(6, Messages.size(new Locale("es")));
94
		TestCase.assertEquals(0, Messages.size(new Locale("fr")));
95

  
96
		// test that keys didn't get overwritten by the new files
97
		// (only new keys should have been added for each language)
98
		TestCase.assertEquals("OK", Messages.getText("aceptar"));
99
		TestCase.assertEquals("Cancel", Messages.getText("cancelar"));
100
		TestCase.assertEquals("Cascade", Messages.getText("Cascada"));
101
		// check the new keys
102
		TestCase.assertEquals("At least one window should be open", Messages.getText("cascada_enable"));
103
		TestCase.assertEquals("Insert first corner point", Messages.getText("insert_first_point_corner"));
104
		TestCase.assertEquals("Capa exportada", Messages.getText("capa_exportada"));
105
		TestCase.assertEquals("Circunscrito", Messages.getText("circumscribed"));
106
		
107
		Messages.removeResources();
108
		TestCase.assertEquals(0, Messages.size(new Locale("en")));
109
		TestCase.assertEquals(0, Messages.size(new Locale("es")));
110
		TestCase.assertEquals(0, Messages.size(new Locale("fr")));
111
		
112
		removeLocales();
113
	}
114
}
0 115

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/dataset2/text.properties
1
#text.properties
2
aceptar=baceptar
3
cancelar=amancebar
4
capa_exportada=Capa exportada
5
circumscribed=Circunscrito
0 6

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/dataset2/text_en.properties
1
#text_en.properties
2
insert_first_point_corner=Insert first corner point
3
cascada_enable=At least one window should be open
4
cancelar=arancelar
0 5

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/dataset2/text_fr.properties
1
#text_fr.properties
2
aceptar=Accepter
3
Cascada=Cascade
4
Configurar=Configurer
0 5

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-test/org/gvsig/i18n/AllTests.java
1
package org.gvsig.i18n;
2

  
3
import junit.framework.Test;
4
import junit.framework.TestSuite;
5

  
6
public class AllTests {
7

  
8
	public static Test suite() {
9
		TestSuite suite = new TestSuite("Test for org.gvsig.i18n");
10
		//$JUnit-BEGIN$
11
		suite.addTestSuite(TestMessages.class);
12
		//$JUnit-END$
13
		return suite;
14
	}
15

  
16
}
0 17

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_de.properties
1
#Translations for language [de]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=OK
4
Las_traducciones_no_pudieron_ser_cargadas=
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=
7
No_se_encontro_la_traduccion_para=Konnte \u00dcbersetzung nicht finden f\u00fcr\:
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_eu.properties
1
#Translations for language [eu]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Ados
4
Las_traducciones_no_pudieron_ser_cargadas=Itzulpenak ezin izan dira kargatu
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=\=Ez da hobetsitako hizkuntzen zerrenda aurkitu. Agian klasea hasieratzea ahaztu zaizu
7
No_se_encontro_la_traduccion_para=Ez da itzulpenik aurkitu honetarako\:
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_it.properties
1
#Translations for language [it]
2
#Tue Nov 07 12:30:01 CET 2006
3
aceptar=Accetta
4
Las_traducciones_no_pudieron_ser_cargadas=
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=
7
No_se_encontro_la_traduccion_para=Non si \u00e9 incontrata la traduzione per
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text.properties
1
#Translations for language [es]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Aceptar
4
Las_traducciones_no_pudieron_ser_cargadas=Las traducciones no pudieron ser cargadas
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=No hay lista de idiomas preferidos. Quiza olvido inicializar la clase
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=No hay lista de idiomas preferidos. Quiz\u00e1 olvid\u00f3 inicializar la clase.
7
No_se_encontro_la_traduccion_para=No se encontr\u00f3 la traducci\u00f3n para
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_en.properties
1
#Translations for language [en]
2
#Wed Nov 08 12:31:46 CET 2006
3
=\=\=\=\=\=\=
4
<<<<<<<=text_en.properties
5
>>>>>>>=1.6
6
aceptar=Accept
7
Las_traducciones_no_pudieron_ser_cargadas=Translations couldn't be loaded
8
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=There is no list of favorite languages probably you forgot initialice the class
9
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=There is not preferred languages list. Maybe the Messages class was not initiated
10
No_se_encontro_la_traduccion_para=Cannot find translation for
0 11

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_gl.properties
1
#Translations for language [gl]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Aceptar
4
Las_traducciones_no_pudieron_ser_cargadas=As traducci\u00f3ns non se puideron cargar
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=Non se atopou a lista de idiomas preferidos.Quiz\u00e1s non se lembrou de inicializar a clase
7
No_se_encontro_la_traduccion_para=Non se atopou a traducci\u00f3n para
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_ca.properties
1
#Translations for language [ca]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Acceptar
4
Las_traducciones_no_pudieron_ser_cargadas=Les traduccions no s'han pogut carregar
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=No s'ha trobat la llista d'idiomes preferits. Potser ha oblidat inicialitzar la classe
7
No_se_encontro_la_traduccion_para=No s'ha trobat la traducci\u00f3 per a
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_pt.properties
1
#Translations for language [pt]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Aceitar
4
Las_traducciones_no_pudieron_ser_cargadas=
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=
7
No_se_encontro_la_traduccion_para=N\u00e3o se encontrou a tradu\u00e7\u00e3o de
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_cs.properties
1
#Translations for language [cs]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Budi\u017e
4
Las_traducciones_no_pudieron_ser_cargadas=
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=
7
No_se_encontro_la_traduccion_para=Nelze nal\u00e9zt p\u0159eklad pro
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/config/text_fr.properties
1
#Translations for language [fr]
2
#Mon Oct 30 09:38:21 CET 2006
3
aceptar=Accepter
4
Las_traducciones_no_pudieron_ser_cargadas=Les traductions ne peuvent pas \u00eatre charg\u00e9es.
5
No.hay.lista.de.idiomas.preferidos.quiza.olvido.inicializar.clase=
6
No_hay_lista_de_idiomas_preferidos_quiza_olvido_inicializar_clase=Impossible de trouver la liste des langues pr\u00e9f\u00e9r\u00e9es. Vous avez peut-\u00eatre oubli\u00e9 d'installer la classe.
7
No_se_encontro_la_traduccion_para=Impossible de trouver les traductions pour
0 8

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-utils/org/gvsig/i18n/utils/AddNewTranslations.java
1
/**
2
 * 
3
 */
4
package org.gvsig.i18n.utils;
5

  
6
import java.io.BufferedReader;
7
import java.io.File;
8
import java.io.FileInputStream;
9
import java.io.FileNotFoundException;
10
import java.io.IOException;
11
import java.io.InputStreamReader;
12
import java.io.UnsupportedEncodingException;
13
import java.util.Enumeration;
14
import java.util.Properties;
15

  
16
/**
17
 * @author cesar
18
 *
19
 */
20
public class AddNewTranslations {
21
	// The filename which stores the configuration (may be overriden by the command line parameter)
22
	private String configFileName = "config.xml";
23
	
24
	// Object to load and store the config options
25
	private ConfigOptions config;
26
	
27
	private TranslationDatabase database;
28

  
29
	/**
30
	 * @param args
31
	 */
32
	public static void main(String[] args) {
33
		AddNewTranslations process = new AddNewTranslations();
34
		
35
		// load command line parameters
36
		if (!process.readParameters(args)) {
37
			usage();
38
			System.exit(-1);
39
		}
40
		
41
		// transfer control to the program's main loop
42
		process.start();
43
	}
44
	
45
	private void start() {
46
		// load config options from the config file
47
		if (!loadConfig()) {
48
			System.out.println("Error leyendo el fichero de configuraci?n.");
49
			usage();
50
			System.exit(-1);
51
		}
52
		
53
		loadDataBase();
54
		
55
		readNewTranslations();
56
		
57
		database.save();
58
	}
59

  
60
	/**
61
	 *  Reads the command line parameters */
62
	private boolean readParameters(String[] args) {
63
		String configPair[];
64

  
65
		for (int i=0; i<args.length; i++) {
66
			configPair = args[i].split("=",2);
67
			if ( (configPair[0].equals("-c") || configPair[0].equals("--config"))
68
					&& configPair.length==2) {
69
				configFileName = configPair[1];
70
			}
71
			else {
72
				return false;
73
			}
74
		}
75
		return true;
76
	}
77
	
78
	private boolean loadConfig() {
79
		config = new ConfigOptions(configFileName);
80
		config.load();
81
		return true;
82
	}
83
	
84
	private static void usage() {
85
		System.out.println("Uso: AddNewTranslations [OPCION]");
86
		System.out.println("\t-c\t--config=configFile");
87
	}
88
	
89
	private void loadDataBase() {
90
		database = new TranslationDatabase(config);
91
		database.load();
92
	}
93
	
94
	private void readNewTranslations() {
95
		String lang, key, value, oldValue;
96
		
97
		for (int i=0; i<config.languages.length; i++) {
98
			lang = config.languages[i];
99
			try {
100
				FileInputStream fisProp = new FileInputStream(config.inputDir+File.separator+config.defaultBaseName+"_"+lang+".properties");
101
				Properties prop = new Properties();
102
				try {
103
					prop.load(fisProp);
104
					Enumeration keysEnum  = prop.keys();
105
					while (keysEnum.hasMoreElements()){
106
						key = (String) keysEnum.nextElement();
107
						value = prop.getProperty(key);
108
						if (value!=null && !value.equals("")) {
109
							if (!database.containsKey(lang, key)) {
110
								System.out.println("["+lang+"] Traducci?n a?adida -- "+key+"="+value);
111
								database.setTranslation(lang, key, value);
112
							}
113
							else {
114
								oldValue = database.setTranslation(lang, key, value);
115
								if (!oldValue.equals(value)) {
116
									System.out.println("["+lang+"] Traducci?n actualizada -- "+key+"="+value);
117
									System.out.println("Valor anterior: "+database.getTranslation(lang, key));
118
								}
119
							}
120
						}
121
					}
122
				} catch (IOException e) {
123
					System.err.println("Error leyendo traducciones para idioma ["+lang+"]. "+e.getLocalizedMessage());
124
				}
125
				
126
			} catch (FileNotFoundException e) {
127
				try {
128
					FileInputStream fis = new FileInputStream(config.inputDir+File.separator+config.defaultBaseName+"_"+lang+".properties-"+config.outputEncoding);
129
					
130
					BufferedReader currentFile=null;
131
					try {
132
						currentFile = new BufferedReader(new InputStreamReader(fis, config.outputEncoding));
133
					} catch (UnsupportedEncodingException e1) {
134
						// TODO Auto-generated catch block
135
						e1.printStackTrace();
136
					}
137
					
138
				    String line = null;
139
				    try {
140
						while((line = currentFile.readLine()) != null) {
141
							String[] parts = line.split("=");
142
							if (parts.length == 2) {
143
								key = parts[0];
144
								value = parts[1];
145
								if (value!=null && !value.equals("")) {
146
									if (!database.containsKey(lang, key)) {
147
										System.out.println("["+lang+"] Traducci?n a?adida -- "+key+"="+value);
148
										database.setTranslation(lang, key, value);
149
									}
150
									else {
151
										oldValue = database.setTranslation(lang, key, value);
152
										if (!oldValue.equals(value)) {
153
											System.out.println("["+lang+"] Traducci?n actualizada -- "+key+"="+value);
154
											System.out.println("Valor anterior: "+database.getTranslation(lang, key));
155
										}
156
									}
157
								}
158
							}
159
							else {
160
								System.err.println("Error leyendo traducciones para idioma ["+lang+"].");
161
								System.err.println("L?nea: "+line);
162
							}
163
						}
164
					    currentFile.close();
165
					} catch (IOException ex) {
166
						System.err.println("Error leyendo traducciones para idioma ["+lang+"]. "+ex.getLocalizedMessage());
167
					}
168
					
169
				} catch (FileNotFoundException e1) {
170
					System.out.println("Aviso -- no se encontraron nuevas traducciones para el idioma ["+lang+"].");
171
				}
172
			}
173
			
174
		}
175
		
176
	}
177
	
178
}
0 179

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-utils/org/gvsig/i18n/utils/config.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<config>
3
	<!-- Aquí especificamos algunas variables de configuración -->
4
	<!-- En este fichero se muestran todas las opciones posibles, en sus valores por defecto -->
5

  
6
	<!-- Nombre base por defecto de los ficheros con las traducciones. En nuestro caso suele ser "text",
7
		de forma que los ficheros toman nombres como "text.properties", "text_en.properties". Nótese
8
		que sólo es el nombre por defecto. Cada proyecto puede especificar un baseName distinto -->
9
	<variable name="basename" value="text" />
10

  
11
	<!-- Directorio base. Las rutas relativas especificadas en otras variables (databaseDir, directorios
12
		de proyecto) tomarán este directorio como directorio base.  Por defecto es el directorio
13
		desde el que se llama a la aplicación -->
14
	<variable name="basedir" value="../" />
15

  
16
	<!-- Lista de idiomas que se tendrán en cuenta  -->
17
	<variable name="languages" value="ca;cs;de;en;es;eu;fr;gl;it;nl;pt;pt_BR;pl;ro;sr;sw;zh;en_US" />
18
	<!-- El directorio que contendrá la base de datos general de traducciones por idioma. Por defecto es el
19
		directorio "database", relativo al directorio especificado en la variable "basedir".  -->
20
	<variable name="databaseDir" value="libInternationalization/utils-data/database" />
21
	
22
	<!-- El directorio por defecto que contendrá los property files que almacenan las claves de cada
23
	 proyecto". Esto se usa en los proyectos que no especifican un atributo "propertyDir". Si el
24
	 directorio no es absoluto, entonces es relativo al directorio de cada proyecto. -->
25
	<variable name="defaultPropertyDir" value="config" />
26
	
27
	<!-- El directorio en el que se escribirán las cadenas para enviar a traducir. -->
28
	<variable name="outputDir" value="libInternationalization/utils-data/output" />
29

  
30
	<!-- El directorio del que se leerán las nuevas cadenas traducidas, que se van a integrar
31
	a la base de datos. -->
32
	<variable name="inputDir" value="libInternationalization/utils-data/input" />
33
	
34
	<!-- Los subdirectorios que contienen fuentes, relativos a cada directorio de
35
	proyecto. Si se especifican varios subdirectorios,  deben ir separado por
36
	 punto y coma (;).  -->
37
	<variable name="srcDirs" value="src;config" />
38

  
39
	
40
	<!-- 	Esta variable especifica el origen de las claves. Los valores posibles son "sources" y "properties".
41
	     	Con esta variable se define el conjunto de valores válidos (esto es, el conjunto de claves que
42
		o bien deben estar traducidas o bien debemos enviar a traducir). El valor por defecto es "sources".
43

  
44
              - "properties" significa que el conjunto de claves válido se determinará tomando las claves
45
		presentes en el fichero .properties del idioma principal de cada proyecto. El idioma
46
		principal de un proyecto se define con el atributo "mainLang" de cada proyecto (si existe),
47
		o con la variable general "mainLang" en caso contrario.
48
	      - "sources" significa que el conjunto de claves válido se determina buscando en el código fuente del
49
		programa. Se buscarán llamadas a las funciones getText y getString y se tomarán las claves de la
50
		llamada, también se buscarán las claves presentes en el config.xml de cada extensión.
51

  
52
		Cada proyecto puede especificar un sourceKeys distinto.
53
	-->
54
	<variable name="sourceKeys" value="sources" />
55

  
56
</config>
57
<projects>
58
	<!-- Los proyectos que se van a leer. Es necesario especificar un directorio (relativo o absoluto),
59
		y opcionalmente se puede incluir un atributo "basename" para especificar un nombre base
60
		distinto del nombre base por defecto -->
61
	<!-- The projects which are going to be read. An absolute or relative directory name must be specified,
62
		in which the property files are located. An optional "basename" attribute is also accepted,
63
		to override the default basename -->
64
	<project dir="appgvSIG" basename="text" sourceKeys="sources" propertyDir="config"/>
65
	<project dir="_fwAndami" />
66
	<project dir="extAddEventTheme" />
67
	<project dir="extCAD" />
68
	<project dir="extCatalogYNomenclator" />
69
	<project dir="extCenterViewToPoint" />
70
	<project dir="extDataLocator" />
71
	<project dir="extGeoProcessing" />
72
	<project dir="extGeoprocessingExtensions" />
73
	<project dir="extGeoreferencing" />
74
	<project dir="extJDBC" />
75
	<project dir="extRasterTools" />
76
	<project dir="extScripting" />
77
	<project dir="extWCS" />
78
	<project dir="extWFS2" />
79
	<project dir="extWMS" />
80
	<project dir="libCorePlugin" />
81
	<project dir="libCq CMS for java" />
82
<!--	<project dir="libDriverManager" /> -->
83
<!--	<project dir="libDwg" /> -->
84
	<!-- <project dir="libFMap" /> -->
85
	<project dir="libInternationalization" />
86
	<project dir="libUI" />
87
	<!-- <project dir="libIverUtiles" /> -->
88
	<!-- <project dir="libRemoteServices" /> -->
89
	<project dir="extArcims" />
90
	<project dir="libArcIMS" />
91
</projects>
0 92

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-utils/org/gvsig/i18n/utils/Project.java
1
/**
2
 * 
3
 */
4
package org.gvsig.i18n.utils;
5

  
6
import java.util.HashMap;
7

  
8
/**
9
 * Convenience class to manage the attributes of the project tag from the config.xml
10
 * file.
11
 * 
12
 * 
13
 * @author cesar
14
 *
15
 */
16
public class Project {
17

  
18
	public String dir;
19
	public String basename;
20
	
21
	/**
22
	 * The directory which stores the property files of the project.
23
	 */
24
	public String propertyDir;
25
	
26
	/**
27
	 * Source of the keys: whether they are loaded from the property files of
28
	 * the project or they are searched inside the sources.
29
	 * <ul><li>sourceKeys="sources": The keys are searched inside the Java source
30
	 * files and the config.xml files from the extensions.</li>
31
	 * <li>sourceKeys="properties": The keys are loaded from the property files
32
	 * of each project.</li></ul> 
33
	 */
34
	public String sourceKeys;
35
	
36
	/**
37
	 * Stores the associated dictionaries. Each value of the
38
	 * HashMap is a Properties object, containing the translations for each
39
	 * language.
40
	 * 
41
	 * <p>Example:</p>
42
	 * Properties dictionary = (Properties)dictionaries.get("es");
43
	 * 
44
	 */
45
	public HashMap dictionaries;
46
	
47
	/**
48
	 * Stores the subdirectories containing sources. When searching for keys in
49
	 * the source files, only these subdirectories will be searched.
50
	 */
51
	public String[] srcDirs;
52
	
53
}
0 54

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-utils/org/gvsig/i18n/utils/DoubleProperties.java
1
/**
2
 * 
3
 */
4
package org.gvsig.i18n.utils;
5

  
6
import java.io.IOException;
7
import java.io.InputStream;
8
import java.util.ArrayList;
9
import java.util.HashMap;
10
import java.util.Iterator;
11

  
12
/**
13
 * The DoubleProperties class represents a set of properties. It provides the
14
 * same functionality as its parent class, Properties. Besides that, it also
15
 * provides an efficient method to get the key associated with a value.  
16
 * 
17
 * @author cesar
18
 *
19
 */
20
public class DoubleProperties extends OrderedProperties {
21
	/**
22
	 * 
23
	 */
24
	private static final long serialVersionUID = -1738114064256800193L;
25
	HashMap reverseMap = new HashMap();
26

  
27
	public DoubleProperties() {
28
		super();
29
	}
30
	
31

  
32
	public DoubleProperties(OrderedProperties defaults) {
33
		super(defaults);
34
		Iterator keysIterator = this.keySet().iterator();
35
		ArrayList keySet;
36
		
37
		String key, value;
38
		while (keysIterator.hasNext()) {
39
			key = (String) keysIterator.next();
40
			value = this.getProperty(key);
41
			if (reverseMap.containsKey(value)) {
42
				keySet = (ArrayList) reverseMap.get(value);
43
				keySet.add(key);
44
			}
45
			else {
46
				keySet = new ArrayList();
47
				keySet.add(key);
48
				reverseMap.put(value, keySet);
49
			}
50
		}
51
	}
52
	
53
	
54
	public void load(InputStream stream) throws IOException {
55
		super.load(stream);
56

  
57
		Iterator keysIterator = this.keySet().iterator();
58
		ArrayList keySet;
59
		
60
		String key, value;
61
		while (keysIterator.hasNext()) {
62
			key = (String) keysIterator.next();
63
			value = this.getProperty(key);
64
			if (reverseMap.containsKey(value)) {
65
				keySet = (ArrayList) reverseMap.get(value);
66
				keySet.add(key);
67
			}
68
			else {
69
				keySet = new ArrayList();
70
				keySet.add(key);
71
				reverseMap.put(value, keySet);
72
			}
73
		}
74
	}
75
	
76
	public Object setProperty(String key, String value) {
77
		ArrayList keySet;
78
		
79
		Object returnValue = super.setProperty(key, value);
80
		if (reverseMap.containsKey(value)) {
81
			keySet = (ArrayList) reverseMap.get(value);
82
			keySet.add(key);
83
		}
84
		else {
85
			keySet = new ArrayList();
86
			keySet.add(key);
87
			reverseMap.put(value, keySet);
88
		}
89
		
90
		return returnValue;
91
	}
92
	
93
	/**
94
	 * Gets the key associated with the provided value. If there
95
	 * are several associated keys, returns one of them.
96
	 * 
97
	 * @param value
98
	 * @return The key associated with the provided value, or null
99
	 * if the value is not present in the dictionary. If there
100
	 * are several associated keys, returns one of them.
101
	 */
102
	public String getAssociatedKey(String value) {
103
		ArrayList keySet = (ArrayList) reverseMap.get(value);
104
		if (keySet==null) return null;
105
		return (String) keySet.get(0);
106
	}
107
	
108
	/**
109
	 * Returns the keys associated with the provided value. If there
110
	 * are several associated keys, returns one of them.
111
	 * 
112
	 * @param value
113
	 * @return An ArrayList containing the keys associated with the
114
	 * provided value, or null if the value is not present in the 
115
	 * dictionary.
116
	 */
117
	public ArrayList getAssociatedKeys(String value) {
118
		return (ArrayList) reverseMap.get(value);
119
	}
120
	
121
	public Object remove(Object key) {
122
		Object value = super.remove(key);
123
		if (value==null) return null;
124
		ArrayList keySet = (ArrayList) reverseMap.get(value);
125
		if (keySet==null) return null;
126
		if (keySet.size()<=1) {
127
			//if it's the last key associated wit the value, remove the
128
			// value from the reverseDictionary			
129
			reverseMap.remove(value);
130
		}
131
		else {
132
			// otherwise, remove the key from the list of associated keys
133
			keySet.remove(key);
134
		}
135
		return value;
136
	}	
137
}
0 138

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-utils/org/gvsig/i18n/utils/UpdateTrans.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
*
3
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana.
4
*
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
*
19
* For more information, contact:
20
*
21
*  Generalitat Valenciana
22
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib??ez, 50
24
*   46010 VALENCIA
25
*   SPAIN
26
*
27
*      +34 963862235
28
*   gvsig@gva.es
29
*      www.gvsig.gva.es
30
*
31
*    or
32
*
33
*   IVER T.I. S.A
34
*   Salamanca 50
35
*   46005 Valencia
36
*   Spain
37
*
38
*   +34 963163400
39
*   dac@iver.es
40
*/
41

  
42

  
43
/**
44
 * 
45
 */
46
package org.gvsig.i18n.utils;
47

  
48
import java.io.BufferedWriter;
49
import java.io.File;
50
import java.io.FileNotFoundException;
51
import java.io.FileOutputStream;
52
import java.io.IOException;
53
import java.io.OutputStreamWriter;
54
import java.io.UnsupportedEncodingException;
55
import java.util.ArrayList;
56
import java.util.HashMap;
57
import java.util.Iterator;
58
import java.util.TreeMap;
59

  
60
/**
61
 * @author cesar
62
 *
63
 */
64
public class UpdateTrans {
65
	// The filename which stores the configuration (may be overriden by the command line parameter)
66
	private String configFileName = "config.xml";
67
	
68
	// Object to load and store the config options
69
	private ConfigOptions config;
70
	
71
	private TranslationDatabase database;
72

  
73
	/**
74
	 * @param args
75
	 */
76
	public static void main(String[] args) {
77
		UpdateTrans process = new UpdateTrans();
78
		
79
		// load command line parameters
80
		if (!process.readParameters(args)) {
81
			usage();
82
			System.exit(-1);
83
		}
84
		
85
		// transfer control to the program's main loop
86
		process.start();
87
	}
88
	
89
	private void start() {
90
		// load config options from the config file
91
		if (!loadConfig()) {
92
			System.out.println("Error leyendo el fichero de configuraci?n.");
93
			usage();
94
			System.exit(-1);
95
		}
96
		
97
		loadKeys();
98
		loadDataBase();
99
		
100
		updateDB();
101
	}
102
	
103
	private void updateDB(){
104
		String lang, auxLang;
105
		String key, value, dbValue;
106
		
107
		HashMap newKeys = detectNewKeys();
108
		TreeMap newKeysDict;
109
		HashMap removedKeys = new HashMap();
110
		
111
		ArrayList removedKeysDict;
112

  
113
		/**
114
		 * Process the new or changed keys
115
		 */
116
		for (int i=0; i<config.languages.length; i++) {
117
			lang = config.languages[i];
118
			File langDir = new File(config.outputDir+File.separator+lang);
119
			langDir.mkdirs();
120
			
121
			// process the keys
122
			newKeysDict = (TreeMap) newKeys.get(lang);
123
			removedKeysDict = new ArrayList();
124
			removedKeys.put(lang, removedKeysDict);
125
			Iterator newKeysIterator = newKeysDict.keySet().iterator();
126
			while (newKeysIterator.hasNext()) {
127
				int numValues=0;
128
				value = null;
129
				key = (String) newKeysIterator.next();
130
				
131
				dbValue = database.getTranslation(lang, key);
132
				ArrayList newKeyList = (ArrayList) newKeysDict.get(key);
133
				String[] newKey;
134
				boolean equal=true;
135
				for (int j=0; j<newKeyList.size(); j++) {
136
					newKey = (String[]) newKeyList.get(j);
137
					if (!newKey[0].equals("")) {
138
						if (dbValue!=null && !dbValue.equals(newKey[0]))
139
							equal = false;
140
						if (numValues==0) { //if there are several non-empty values, take the first one
141
							value = newKey[0];
142
						}
143
						else if (!value.equals(newKey[0])) {
144
							equal=false;
145
						}
146
						numValues++;	
147
					}
148
				}
149
				if (equal==false) {
150
					System.err.println("\nAtenci?n -- La clave '"+key+"' tiene diferentes valores para el idioma "  + lang + ".");
151
					System.err.println("Valor en base de datos: "+key+"="+dbValue);
152
					for (int j=0; j<newKeyList.size(); j++) {
153
						newKey = (String[]) newKeyList.get(j);
154
						System.err.println(newKey[1] + " -- " + key + "=" + newKey[0]);
155
					}
156
				}
157
				if (value!=null && !value.equals("")) { // the translation has a value
158
					if (dbValue==null) {
159
						// new translation
160
						database.setTranslation(lang, key, value);
161
						// it has been added to database, it isn't new anymore
162
						// we add the key to the list of keys to remove. We don't remove it now because then there is troubles with the iterator
163
						removedKeysDict.add(key);
164
					}
165
					else if (!dbValue.equals("")) {
166
						// if dbValue contains a translation, it isn't a new translation
167
						removedKeysDict.add(key);
168
					}
169
					/*
170
					 * else { // if dbValue.equals(""), it means that the key has been changed, and it must be sent for translation
171
					 *       //It should not be added to the database with the value from the property file, as it is not valid anymore.
172
					 * 
173
					 * }
174
					 */
175
				}
176
			}
177
		}
178
		
179
		// remove 
180
		for (int i=0; i<config.languages.length; i++) {
181
			lang = config.languages[i];
182
			removedKeysDict = (ArrayList) removedKeys.get(lang);
183
			newKeysDict = (TreeMap) newKeys.get(lang);
184
			Iterator removeIterator = removedKeysDict.iterator();
185
			while (removeIterator.hasNext()) {
186
				key = (String) removeIterator.next();
187
				newKeysDict.remove(key);
188
			}
189
		}
190
		
191
		removedKeys = new HashMap();
192
		
193
		// we already added all the new keys with value to the database
194
		// now we try to find a translation for the keys without translation
195
		for (int i=0; i<config.languages.length; i++) {
196
			lang = config.languages[i];
197
			File langDir = new File(config.outputDir+File.separator+lang);
198
			langDir.mkdirs();
199
			
200
			// process the keys
201
			newKeysDict = (TreeMap) newKeys.get(lang);
202
			removedKeysDict = new ArrayList();
203
			removedKeys.put(lang, removedKeysDict);
204
			Iterator newKeysIterator = newKeysDict.keySet().iterator();
205
			while (newKeysIterator.hasNext()) {
206
				key = (String) newKeysIterator.next();
207
				value = "";
208
				String auxValue;
209
				for (int currentAuxLang=0; currentAuxLang<config.languages.length && (value==null || value.equals("")); currentAuxLang++) {
210
					auxLang = config.languages[currentAuxLang];
211
					auxValue = database.getTranslation(auxLang, key);
212
					if (auxValue!=null && !auxValue.equals("")) {
213
						ArrayList keyList = database.getAssociatedKeys(auxLang, value);
214
						if (keyList!=null) {
215
							for (int j=0; j<keyList.size() && (value==null || !value.equals("")); j++) {
216
								value = database.getTranslation(lang, (String)keyList.get(j));
217
							}
218
						}
219
					}
220
				}
221
				if (value!=null && !value.equals("")) { // the translation has a value
222
					dbValue = database.getTranslation(lang, key);
223
					if (dbValue==null || !dbValue.equals("")) {
224
						/* if dbValue == "" means that the key has been changed and should be sent for translation.
225
						 * It should not be added to the database with the value from the property file, as it is not valid anymore.
226
						 */
227
											
228
						database.setTranslation(lang, key, value);
229
						// it has been added to database, it isn't new anymore
230
						// we add the key to the list of keys to remove. We don't remove it now because then there is troubles with the iterator
231
						removedKeysDict.add(key);
232
					}
233
				}
234
			}
235
		}
236
		
237
		// remove 
238
		for (int i=0; i<config.languages.length; i++) {
239
			lang = config.languages[i];
240
			removedKeysDict = (ArrayList) removedKeys.get(lang);
241
			newKeysDict = (TreeMap) newKeys.get(lang);
242
			Iterator removeIterator = removedKeysDict.iterator();
243
			while (removeIterator.hasNext()) {
244
				key = (String) removeIterator.next();
245
				newKeysDict.remove(key);
246
			}
247
		}
248
		
249
		// output the keys to be translated
250
		outputNewKeys(newKeys);
251
		
252
		// update the values of each project's property files and store to disk
253
		saveKeys();
254
		
255
		// store datase to disk
256
		database.save();
257
	}
258
	
259
	private void outputNewKeys(HashMap newKeys) {
260
		String lang, auxLang;
261
		/**
262
		 * Process the new or changed keys
263
		 */
264
		for (int i=0; i<config.languages.length; i++) {
265
			lang = config.languages[i];
266
			File langDir = new File(config.outputDir+File.separator+lang);
267
			langDir.mkdirs();
268
			HashMap outputFiles = new HashMap();
269
			HashMap outputPropertiesStream = new HashMap();
270
			HashMap outputProperties = new HashMap();
271
			
272
			// open the output files, one for each defined language
273
			for (int j=0; j<config.outputLanguages.length; j++) {
274
				auxLang = config.outputLanguages[j];
275
				FileOutputStream fos, fosProp;
276
				OrderedProperties prop;
277
				try {
278
					fos = new FileOutputStream(langDir.getPath()+File.separator+config.defaultBaseName+"_"+auxLang+".properties-"+config.outputEncoding);
279
					fosProp = new FileOutputStream(langDir.getPath()+File.separator+config.defaultBaseName+"_"+auxLang+".properties");
280
					prop = new OrderedProperties();
281
					outputPropertiesStream.put(auxLang, fosProp);
282
					outputProperties.put(auxLang, prop);
283
					try {
284
						outputFiles.put(auxLang, new BufferedWriter(new OutputStreamWriter(fos, config.outputEncoding)));
285
					} catch (UnsupportedEncodingException e) {
286
						// TODO Auto-generated catch block
287
						System.err.println(e.getLocalizedMessage());
288
						System.exit(-1);
289
					}
290
				} catch (FileNotFoundException e) {
291
					// TODO Auto-generated catch block
292
					System.err.println(e.getLocalizedMessage());
293
					System.exit(-1);
294
				}
295
			}
296
			
297
			// also open the file for language we're processing currently
298
			if (!outputFiles.containsKey(lang)) {
299
				FileOutputStream fos, fosProp;
300
				OrderedProperties prop;
301
				try {
302
					fos = new FileOutputStream(langDir.getPath()+File.separator+config.defaultBaseName+"_"+lang+".properties-"+config.outputEncoding);
303
					fosProp = new FileOutputStream(langDir.getPath()+File.separator+config.defaultBaseName+"_"+lang+".properties");
304
					prop = new OrderedProperties();
305
					outputPropertiesStream.put(lang, fosProp);
306
					outputProperties.put(lang, prop);
307
					try {
308
						outputFiles.put(lang, new BufferedWriter(new OutputStreamWriter(fos, config.outputEncoding)));
309
					} catch (UnsupportedEncodingException e) {
310
						// TODO Auto-generated catch block
311
						System.err.println(e.getLocalizedMessage());
312
						System.exit(-1);
313
					}
314
				} catch (FileNotFoundException e) {
315
					// TODO Auto-generated catch block
316
					System.err.println(e.getLocalizedMessage());
317
					System.exit(-1);
318
				}
319
			}
320
			
321
			TreeMap dict = (TreeMap) newKeys.get(lang);
322
			Iterator keyIterator = dict.keySet().iterator();
323
			String key, value;
324
			while (keyIterator.hasNext()) {
325
				key = (String) keyIterator.next();
326

  
327
				Iterator files = outputFiles.keySet().iterator();
328
				BufferedWriter writer;
329
				while (files.hasNext()) {
330
					// we output the pair key-value for the defined output languages (they're used for reference by translators)							
331
					auxLang = (String) files.next();
332
					writer = (BufferedWriter) outputFiles.get(auxLang);
333
					value = database.getTranslation(auxLang, key);
334
					try {
335
						if (value!=null)
336
							writer.write(key+"="+value+"\n");
337
						else
338
							writer.write(key+"=\n");
339
					} catch (IOException e) {
340
						// TODO Auto-generated catch block
341
						e.printStackTrace();
342
					}
343
				}
344
				Iterator props = outputProperties.keySet().iterator();
345
				OrderedProperties prop;
346
				while (props.hasNext()) {
347
					// we output the pair key-value for the defined output languages (they're used for reference by translators)							
348
					auxLang = (String) props.next();
349
					prop = (OrderedProperties) outputProperties.get(auxLang);
350
					value = database.getTranslation(auxLang, key);
351
					if (value!=null)
352
						prop.put(key, value);
353
					else
354
						prop.put(key, "");
355
				}
356
			}
357
			
358
			Iterator props = outputProperties.keySet().iterator();
359
			OrderedProperties prop;
360
			FileOutputStream fos;
361
			while (props.hasNext()) {
362
				auxLang = (String) props.next();
363
				fos = (FileOutputStream) outputPropertiesStream.get(auxLang);
364
				prop = (OrderedProperties) outputProperties.get(auxLang);
365
				try {
366
					prop.store(fos, "Translations for language ["+auxLang+"]");
367
				} catch (IOException e) {
368
					// TODO Auto-generated catch block
369
					e.printStackTrace();
370
				}
371
			}
372
			
373
			// close the files now
374
			Iterator files = outputFiles.keySet().iterator();
375
			while (files.hasNext()) {							
376
				auxLang = (String) files.next();
377
				BufferedWriter writer = (BufferedWriter) outputFiles.get(auxLang);
378
				try {
379
					writer.close();
380
				} catch (IOException e) {
381
					// do nothing here
382
				}
383
			}
384
		}		
385
	}
386
		
387
	private HashMap detectNewKeys() {
388
		Project currentProject;
389
		String lang;
390
		OrderedProperties dict;
391
		TreeMap auxDict;
392
		Iterator keys;
393
		String key, value, dbValue;
394
		HashMap newKeys = new HashMap();
395
		for (int i=0; i<config.languages.length; i++) {
396
			lang = config.languages[i];
397
			newKeys.put(lang, new TreeMap());
398
		}
399
	
400
		/**
401
		 * Detect the new or changed keys
402
		 * We just make a list, we will check the list later (to detect conflicting changes)
403
		 */
404
		for (int i=0; i<config.projects.size(); i++) {
405
			currentProject = (Project) config.projects.get(i);
406
			for (int j=0; j<config.languages.length; j++) {
407
				lang = config.languages[j];
408
				dict = (OrderedProperties) currentProject.dictionaries.get(lang);
409
				keys = dict.keySet().iterator();
410
				while (keys.hasNext()) {
411
					key = (String) keys.next();
412
					value = dict.getProperty(key);
413
					dbValue = database.getTranslation(lang, key);
414
					if (dbValue==null || dbValue.equals("") || (!value.equals("") && !dbValue.equals(value))) {
415
						String []newKey = new String[2];
416
						newKey[0]=value;
417
						newKey[1]= currentProject.dir;
418
						auxDict = (TreeMap) newKeys.get(lang);
419
						ArrayList keyList = (ArrayList) auxDict.get(key);
420
						if (keyList==null) {
421
							keyList = new ArrayList();
422
						}
423
						keyList.add(newKey);
424
						auxDict.put(key, keyList);
425
					}
426
				}
427
			}
428
		}
429
		return newKeys;
430
	}
431
	
432
	private static void usage() {
433
		System.out.println("Uso: UpdateTrans [OPCION]");
434
		System.out.println("\t-c\t--config=configFile");
435
	}
436
	
437
	/**
438
	 *  Reads the command line parameters */
439
	private boolean readParameters(String[] args) {
440
		String configPair[];
441

  
442
		for (int i=0; i<args.length; i++) {
443
			configPair = args[i].split("=",2);
444
			if ( (configPair[0].equals("-c") || configPair[0].equals("--config"))
445
					&& configPair.length==2) {
446
				configFileName = configPair[1];
447
			}
448
			else {
449
				return false;
450
			}
451
		}
452
		return true;
453
	}
454
	
455
	private boolean loadConfig() {
456
		config = new ConfigOptions(configFileName);
457
		config.load();
458
		return true;
459
	}
460
	
461
	/**
462
	 * Reads the translation keys from the projects speficied in
463
	 * the config file. The keys are stored for each project in
464
	 * 'config.projects'. 
465
	 * 
466
	 * @return
467
	 */
468
	private void loadKeys() {
469
		Keys keys = new Keys(config);
470
		keys.load();
471
	}
472
	
473
	private void saveKeys() {
474
		Project project;
475
		OrderedProperties dict;
476
		String lang;
477
		
478
		for (int currentProject=0; currentProject<config.projects.size(); currentProject++) {
479
			project = ((Project)config.projects.get(currentProject));
480
			
481
			for (int currentLang=0; currentLang<config.languages.length; currentLang++) {
482
				lang = (String) config.languages[currentLang];
483
				dict = (OrderedProperties) project.dictionaries.get(lang);
484
				String dbValue, key;
485

  
486
				Iterator keysIterator = dict.keySet().iterator();
487
				while (keysIterator.hasNext()) {
488
					key = (String) keysIterator.next();
489
					dbValue = database.getTranslation(lang, key);
490
					if (dbValue!=null) {
491
						dict.setProperty(key, dbValue);
492
					}
493
				}
494
			}
495
		}
496
		
497
		Keys keys = new Keys(config);
498
		keys.save();
499
	}
500
	
501
	private void loadDataBase() {
502
		database = new TranslationDatabase(config);
503
		database.load();
504
	}
505

  
506
}
0 507

  
tags/v2_0_0_Build_2055/libraries/libInternationalization/src-utils/org/gvsig/i18n/utils/Keys.java
1
/**
2
 * 
3
 */
4
package org.gvsig.i18n.utils;
5

  
6
import java.io.BufferedReader;
7
import java.io.File;
8
import java.io.FileInputStream;
9
import java.io.FileNotFoundException;
10
import java.io.FileOutputStream;
11
import java.io.IOException;
12
import java.io.InputStreamReader;
13
import java.io.UnsupportedEncodingException;
14
import java.util.HashMap;
15
import java.util.HashSet;
16
import java.util.Iterator;
17
import java.util.regex.Matcher;
18
import java.util.regex.Pattern;
19

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff