Java Applet Locale setting

I am running an english language version of WindowsXP, but have set Spanish as my only accepted language in Firefox. I had naively expected the browser's language to be set as the default when I load an applet in a browser session, but this does not appear to be the case. The applet starts up in English, the default language of the OS.

I could add a new <param> to my Applet and call Locale.setDefault() during initialization, but before I start hacking away I'd like to know if I'm missing something obvious. Is there a common mechanism by which the browser or invoking web page can set the default language of an <applet> ?

Asked by: Aida145 | Posted: 23-01-2022

Answer 1

The java plugin uses the OS locale not the browser one.

To override the default locale, go in the java control panel - java tab, Press the View button of the Applet Runtime Settings, and add the required parameter in the 4th column, it is editable even if it's grayed.

In your case, try something like -Duser.language=es


Answered by: William534 | Posted: 24-02-2022

Answer 2

Previously, the default locale for applets and for Java-applications was derived from the locale of Windows. With jre 7 this is still true for Java-applications, but it is no longer true for applets. The default locale for applets is en_US no matter how you set the Windows locale. This must truely be a bug related to the Java plugin. /Aron

Answered by: Kevin907 | Posted: 24-02-2022

Similar questions

localization - Is there an elegant way to convert ISO 639-2 (3 letter) language codes to Java Locales?

E.g. eng, spa, ita, ger I could iterate all locales and compare the codes, but I wonder whether there is a more elegant &amp; performant way to achieve this.... Thanks a lot for any hints :)

Managing the localization of Java properties files

I have a Web application written in Java that is targeting several countries, all of which speak different languages (and more often than not, several languages -- that's Europe for you). We have a bunch of .properties files that hold the localized strings, and our current procedure is to e-mail the language-specific files to our partners for updating before doing major updates. However, this p...

java - PHP Localization Mechanism

What's the best way to localize a PHP page? We have several PHP pages that need to be deployed to other countries. They are hard-coded in English now. I am looking for a mechanism to externalize the text and localize it. Something like ResourceBundle in Java would be great. We don't use any frameworks.

localization - How to set the browser locale for Selenium tests running in Java?

I've been looking for a while an...

localization - Java stacktrace in different locales

I'm trying to do some automatic parsing of java exceptions and stacktraces being sent to our central server (written in c#). I have an algorithm working now which parses the stacktraces to a standard representation and in the process attempt to determine the locale which generated the exception, but have only tested on english and would like to validate for other locales as well. More specifically each line in the...

what localization changes are needed for Arabic with Java Applet

How big task is it to implement support for Arabic localization, our Java 1.5 Applet was designed as fully localizable (european languages) but now we plan to add also arabic as a new language. We are using custom GUI text i/o components inherited from Component class using e.g. Drawstring, how well is arabic supported within Component class ? The keyboard input is done with KeyListener getKeyChar, getKeyCode ...

java - What are the pro and cons of having localization files vs hard coded variables in source code?

Definitions: Files: Having the localization phrases stored in a physical file that gets read at application start-up and the phrases are stored in the memory to be accessed via util-methods. The phrases are stored in key-value format. One file per language. Variables: The localization texts are stored as hard code variables in the application's source code. The variables are complex data typ...

swing - Java localization best practices

I have a Java application with server and Swing client. Now I need to localize the user interface and possibly also some of the data needs to be locale specific. There are few things in specific I would like to hear your opinions on. How should I distribute the localized strings for the UI into properties files? In my application there are several views and each has several panels. Should I have one localizat...

localization - Location of currency symbol for a particular currency in java

I know the way to get the Currency Object and other details for a currency in java using locale and NumberFormat class. But I am not able to find anything in the API to know whether currency symbol is display at start or end E.g. 10 in US is $10 where $ is in the start of number) 10 in Zloty (polish currency) is 10 z (z to represent zloty symbol though actual symbol is different). Is there any propert...

localization - Detect AM/PM vs 24 hr clock preference from Java Locale information?

I am looking for a way to tell in a Java program if a particular locale prefers display of time in 12 hour AM/PM or in 24 hour clock. Now, normally I would just use DateFormat to properly format the date as appropriate for the Locale. However, I'm attempting to localize a stem-and-leaf calendar display of transit schedules which requires some direct knowledge of the locale preferences. You can see an example of a schedu...

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)