Recently in the implementation of Liferay found Liferay find this translation is really bad, a lot of things translated simply Dog, such as the forum topic translated into "thread", the virtual host translated as "real owner", or there is no translation. A look is a person who has no experience in program development and may be a Taiwanese person.
No way can only do for Liferay to do the Han chemical.
Liferay resource file is still good, basically all the messages in the interface are placed in the resource file. The specific Chinese is: portal-impl/content the following language_zh_cn.properties and Language_zh_CN.properties.native. The previous one is a Unicode string, and the latter one is Chinese. It is OK to translate the contents of the native file first, and then convert the Chinese characters to Unicode to replace the previous one.
Can native file actually have more than 3,000, if all hand through native2asccii to convert words, it is a nightmare. Because I am lazy, of course, to use lazy way. Wrote a Java program called Native2ascii to get it done.
The code is as follows:
Import Java.io.FileInputStream;
Import Java.io.FileWriter;
Import java.io.IOException;
Import Java.io.InputStreamReader;
Import Java.io.OutputStream;
Import java.io.UnsupportedEncodingException;
Import Java.util.Iterator;
Import java.util.Properties;
/** */ /**
* @author Smilingleo e-mail:liuwei.dt@gmail.com
* @version created Time:2007-11-2 11:37:55 class Description:
*/
public class Native2ascii ... {
static String Java_bin_path = "C:/java/jdk1.5/bin";
Public Native2ascii () ... {
}
Public Properties getProperties (String filename) throws IOException ... {
Properties P = new properties ();
ClassLoader cl = This.getclass (). getClassLoader ();
FileInputStream input;
input = new FileInputStream (filename);
P.load (input);
return p;
}
public string getunicodestring (string value) ... {
StringBuffer TEMPSB = new StringBuffer ();
Try ... {
Process Pro = Runtime.getruntime (). EXEC (
Java_bin_path + "/native2ascii.exe");
OutputStream out = Pro.getoutputstream ();
Out.write (Value.getbytes ());
Out.flush ();
Out.close ();
InputStreamReader child_in = new InputStreamReader (Pro.getinputstream ());
int C;
while ((c = child_in.read ())!=-1) ... {
Tempsb.append ((char) c);
}
catch (Unsupportedencodingexception e) ... {
E.printstacktrace ();
catch (IOException ex) ... {
Ex.printstacktrace ();
}
return tempsb.tostring ();
}
/** *//**
* @param args
*/
public static void Main (string[] args) ... {
String sourcefile = "Language_zh_cn.properties";
String targetfile = "Target.properties";
if (args.length!= 2) ... {
System.out.println ("Usage:java native2ascii <source properties filename> <target filename>" +
&n