1 |
alfonx |
780 |
package skrueger.i8n; |
2 |
|
|
/******************************************************************************* |
3 |
alfonx |
862 |
* Copyright (c) 2010 Stefan A. Tzeggai (soon changing to Stefan A. Tzeggai). |
4 |
alfonx |
780 |
* All rights reserved. This program and the accompanying materials |
5 |
|
|
* are made available under the terms of the GNU Public License v2.0 |
6 |
|
|
* which accompanies this distribution, and is available at |
7 |
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
8 |
|
|
* |
9 |
|
|
* Contributors: |
10 |
alfonx |
862 |
* Stefan A. Tzeggai (soon changing to Stefan A. Tzeggai) - initial API and implementation |
11 |
alfonx |
780 |
******************************************************************************/ |
12 |
|
|
import java.io.BufferedReader; |
13 |
|
|
import java.io.File; |
14 |
|
|
import java.io.FileReader; |
15 |
|
|
import java.io.IOException; |
16 |
|
|
import java.util.HashMap; |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
/** |
20 |
|
|
* This tool helps to find missing frensh translations |
21 |
|
|
* |
22 |
|
|
*/ |
23 |
|
|
public class TranslationTool { |
24 |
|
|
|
25 |
|
|
static File GPenglish = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/bin/skrueger/creator/resource/locales/Geopublisher.properties"); |
26 |
|
|
static File GPfrensh = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/bin/skrueger/creator/resource/locales/Geopublisher_fr.properties"); |
27 |
|
|
|
28 |
|
|
static File ASenglish = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/sld/resources/locales/AtlasStylerTranslation.properties"); |
29 |
|
|
static File ASfrensh = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/sld/resources/locales/AtlasStylerTranslation_fr.properties"); |
30 |
|
|
|
31 |
|
|
static File AVenglish = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/atlas/resource/locales/AtlasViewerTranslation.properties"); |
32 |
|
|
static File AVfrensh = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/atlas/resource/locales/AtlasViewerTranslation_fr.properties"); |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
private static HashMap<String,String> frenshTranslations = new HashMap<String, String>(); |
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* @param args |
39 |
|
|
* @throws IOException |
40 |
|
|
*/ |
41 |
|
|
public static void main(String[] args) throws IOException { |
42 |
|
|
|
43 |
|
|
|
44 |
|
|
BufferedReader en_Reader; |
45 |
|
|
BufferedReader fr_Reader; |
46 |
|
|
|
47 |
|
|
int mode = 3; |
48 |
|
|
|
49 |
|
|
if (mode == 1) { |
50 |
|
|
en_Reader = new BufferedReader(new FileReader(GPenglish)); |
51 |
|
|
fr_Reader = new BufferedReader(new FileReader(GPfrensh)); |
52 |
|
|
} else if (mode == 2) { |
53 |
|
|
en_Reader = new BufferedReader(new FileReader(ASenglish)); |
54 |
|
|
fr_Reader = new BufferedReader(new FileReader(ASfrensh)); |
55 |
|
|
} else { |
56 |
|
|
en_Reader = new BufferedReader(new FileReader(AVenglish)); |
57 |
|
|
fr_Reader = new BufferedReader(new FileReader(AVfrensh)); |
58 |
|
|
} |
59 |
|
|
|
60 |
|
|
|
61 |
|
|
// Read all frensh translations keys into a HashMap |
62 |
|
|
String readLine = "start"; |
63 |
|
|
while (readLine != null) { |
64 |
|
|
readLine = fr_Reader.readLine(); |
65 |
|
|
if (readLine != null && !readLine.startsWith("#")) { |
66 |
|
|
int indexOf = readLine.indexOf("="); |
67 |
|
|
if (indexOf == -1) continue; |
68 |
|
|
String key = readLine.substring(0,indexOf).trim(); |
69 |
|
|
String value = readLine.substring(indexOf+1).trim(); |
70 |
|
|
frenshTranslations .put(key.trim(),value.trim()); |
71 |
|
|
} |
72 |
|
|
} |
73 |
|
|
|
74 |
|
|
System.out.println(frenshTranslations.size()+" frensh imported"); |
75 |
|
|
|
76 |
|
|
readLine = "start"; |
77 |
|
|
int missing =0; |
78 |
|
|
while (readLine != null) { |
79 |
|
|
readLine = en_Reader.readLine(); |
80 |
|
|
|
81 |
|
|
if (readLine != null && !readLine.startsWith("#")) { |
82 |
|
|
int indexOf = readLine.indexOf("="); |
83 |
|
|
if (indexOf == -1) continue; |
84 |
|
|
String key = readLine.substring(0,indexOf).trim(); |
85 |
|
|
String value = readLine.substring(indexOf+1).trim(); |
86 |
|
|
if (!frenshTranslations.containsKey(key)) { |
87 |
|
|
System.out.println("#"+key+"="+value+"\n"); |
88 |
|
|
missing++; |
89 |
|
|
} |
90 |
|
|
} |
91 |
|
|
} |
92 |
|
|
System.out.println("missing = "+missing); |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
} |