NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

JDK1.0.2 simulations (1996-2001) => Mirror sites and different language versions => Topic started by: Fu-Kwun Hwang on March 10, 2004, 06:23:57 am



Title: Translate Strings into local language format
Post by: Fu-Kwun Hwang on March 10, 2004, 06:23:57 am
I received lots of email asking for translating "String"s or "Label"s in the java applets.
After several days of work, I modified all the java applets to make it easier to change the strings.
Examples:The following is java applet with default parameters

<applet code="translate.class" width=200 height=100>
<param name="Reset" value="Reset">
<param name="Clear" value="Clear">
<param name="choices" value="choice a,choice b,choice c">
</applet>


The following is java applet with new parameters

<applet code="translate.class" width=300 height=100>
<param name="Reset" value="New Label">
<param name="Clear" value="You can use local characters">
<param name="choices" value="test 1, select 2, item 3 ">
</applet>


For choice(selected items), items are separated by "," .And please DO NOT use more items than the number of original parameters.
Modify value field of the parameters, not the name field.


What you should do is copy my original web page to a different filename and modidy java applet parameters.
Enjoy it! Please send me any comments you might have!


Title: Re: Translate Strings into local language format
Post by: rmokhtar on March 13, 2009, 12:25:54 am
Hi sir,

thanks for putting in that modification some 5 years ago. However, it produces blocks when I enter the names in Arabic.

For example:

Code:
   
<applet code="thickLens.class" width=500 height=340>
<param name="Reset" value="إعادة">
<param name="MSG" value="معامل الانكسار">
<param name="Nchoices" value="3">
<param name="choices" value="ماء,1.333,زجاج,1.500,الماس,2.417">
<param name="user" value="user define">
</applet>

produces the screen shot attached.

Have I forgotten to set something somewhere in my browser or the Java applet runtime settings?

Thanks in advance,
Reem


Title: Re: Translate Strings into local language format
Post by: Fu-Kwun Hwang on March 13, 2009, 04:14:06 pm
Let me check it! I just copied you parameters and posted it here. It seems look fine with my browser.
The applet shows values you have provided (Even I do not understand it. But I think it is the same).
I set the character cording for the browser to utf-8. If you change it to other values, it would not work.



Title: Re: Translate Strings into local language format
Post by: rmokhtar on March 13, 2009, 09:20:05 pm
Took me a while but I figured it out. Just in case someone else has this problem:

It's not the browser encoding settings, it's the Java applet runtime settings. My browser was already set for utf-8 encoding when I had this problem.

http://mindprod.com/jgloss/encoding.html#SUPPORT

The applet here shows you what your default Java runtime encoding scheme is. For me it was Cp1252. By adding "-Dfile.encoding=UTF-8" to the runtime parameters, and restarting your browser (making sure the Java process restarts as well), you can make your Java runtime display it in utf-8. (I rechecked that this was the reason by changing it back to Cp1252 and restarting my browser again).

In Windows (haven't tried it in *nix), when you run Java there's a little icon that you can right click to get to the Java Control Panel. Once you open that, go to the Java tab, then click on the "View" button under Java Applet Runtime Settings, from there you should see a window similar to the attached image.

At the row with the version of Java that is currently enabled ('Enable' checkbox checked), add the following under the "Java Runtime Parameters" field, add "-Dfile.encoding=UTF-8".

Take care,
Reem


Title: Re: Translate Strings into local language format
Post by: Fu-Kwun Hwang on March 13, 2009, 10:13:37 pm
Thank you very much for your valuable information. :D


Title: Re: Translate Strings into local language format
Post by: georgerobinson on December 21, 2010, 02:29:02 pm
Hey, its quite informative to me like people, one can get great benefits from your good efforts to finalize this.

Thanks for good sharing. :)