Author Topic: Translate Strings into local language format  (Read 46875 times)

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Translate Strings into local language format
« on: March 10, 2004, 07: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!

rmokhtar

  • Newbie
  • *
  • Posts: 3
Re: Translate Strings into local language format
« Reply #1 on: March 13, 2009, 01: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:

 
<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

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Translate Strings into local language format
« Reply #2 on: March 13, 2009, 05:14:06 pm »
Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME


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.

?">? ????????">,1.500,?????,2.417">


Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list
If java program did not show up, please download and install latest Java RUN TIME

rmokhtar

  • Newbie
  • *
  • Posts: 3
Re: Translate Strings into local language format
« Reply #3 on: March 13, 2009, 10: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

Fu-Kwun Hwang

  • Administrator
  • Hero Member
  • *****
  • Posts: 3062
    • Enjoy the fun of physics with simulations
Re: Translate Strings into local language format
« Reply #4 on: March 13, 2009, 11:13:37 pm »
Thank you very much for your valuable information. :D

georgerobinson

  • Newbie
  • *
  • Posts: 4
Re: Translate Strings into local language format
« Reply #5 on: December 21, 2010, 03: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. :)