/[schmitzm]/trunk/src/skrueger/i8n/TranslationTool.java
ViewVC logotype

Contents of /trunk/src/skrueger/i8n/TranslationTool.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 893 - (show annotations)
Thu Jun 3 19:01:53 2010 UTC (14 years, 8 months ago) by alfonx
File MIME type: text/plain
File size: 4088 byte(s)
Important PostGIS GUI fix.. the password was wrongly transferred recently
1 package skrueger.i8n;
2 /*******************************************************************************
3 * Copyright (c) 2010 Stefan A. Tzeggai (soon changing to Stefan A. Tzeggai).
4 * 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 * Stefan A. Tzeggai (soon changing to Stefan A. Tzeggai) - initial API and implementation
11 ******************************************************************************/
12 import java.io.BufferedReader;
13 import java.io.File;
14 import java.io.FileReader;
15 import java.io.IOException;
16 import java.net.URISyntaxException;
17 import java.util.HashMap;
18 import java.util.Locale;
19
20 import schmitzm.lang.ResourceProvider;
21
22
23 /**
24 * This tool helps to find missing french translations
25 *
26 */
27 public class TranslationTool {
28
29 static File GPenglish = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/bin/skrueger/creator/resource/locales/GeopublisherTranslation.properties");
30 static File GPfrench = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/bin/skrueger/creator/resource/locales/GeopublisherTranslation_fr.properties");
31
32 static File ASenglish = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/sld/resources/locales/AtlasStylerTranslation.properties");
33 static File ASfrench = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/sld/resources/locales/AtlasStylerTranslation_fr.properties");
34
35 static File AVenglish = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/atlas/resource/locales/AtlasViewerTranslation.properties");
36 static File AVfrench = new File ("/home/stefan/EigeneDateien/code/atlas/trunk/Atlas-Framework/src/skrueger/atlas/resource/locales/AtlasViewerTranslation_fr.properties");
37
38 private static HashMap<String,String> frenchTranslations = new HashMap<String, String>();
39
40 /**
41 * @param args
42 * @throws IOException
43 * @throws URISyntaxException
44 */
45 public static void main(String[] args) throws IOException, URISyntaxException {
46
47 Locale dl = Locale.getDefault();
48
49 for (ResourceProvider p : ResourceProvider.getRegisteredResourceProvider()){
50
51 for (Locale l : p.getAvailableLocales(false)) {
52 File propertyFile = ResourceProvider.getPropertyFile(p, l, null);
53 }
54 }
55
56
57 BufferedReader en_Reader;
58 BufferedReader fr_Reader;
59
60 int mode = 3;
61
62 if (mode == 1) {
63 en_Reader = new BufferedReader(new FileReader(GPenglish));
64 fr_Reader = new BufferedReader(new FileReader(GPfrench));
65 } else if (mode == 2) {
66 en_Reader = new BufferedReader(new FileReader(ASenglish));
67 fr_Reader = new BufferedReader(new FileReader(ASfrench));
68 } else {
69 en_Reader = new BufferedReader(new FileReader(AVenglish));
70 fr_Reader = new BufferedReader(new FileReader(AVfrench));
71 }
72
73
74 // Read all french translations keys into a HashMap
75 String readLine = "start";
76 while (readLine != null) {
77 readLine = fr_Reader.readLine();
78 if (readLine != null && !readLine.startsWith("#")) {
79 int indexOf = readLine.indexOf("=");
80 if (indexOf == -1) continue;
81 String key = readLine.substring(0,indexOf).trim();
82 String value = readLine.substring(indexOf+1).trim();
83 frenchTranslations .put(key.trim(),value.trim());
84 }
85 }
86
87 System.out.println(frenchTranslations.size()+" french imported");
88
89 readLine = "start";
90 int missing =0;
91 while (readLine != null) {
92 readLine = en_Reader.readLine();
93
94 if (readLine != null && !readLine.startsWith("#")) {
95 int indexOf = readLine.indexOf("=");
96 if (indexOf == -1) continue;
97 String key = readLine.substring(0,indexOf).trim();
98 String value = readLine.substring(indexOf+1).trim();
99 if (!frenchTranslations.containsKey(key)) {
100 System.out.println("#"+key+"="+value+"\n");
101 missing++;
102 }
103 }
104 }
105 System.out.println("missing = "+missing);
106 }
107
108
109
110 }

Properties

Name Value
svn:eol-style native
svn:keywords Id URL
svn:mime-type text/plain

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26