Default locale of application
Hi,
I am using Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
I have a basic query. I was playing around with locales. I set my application default locale and supported locale as below in the faces-config.xml
<locale-config>
<default-locale>en</default-locale>
<supported-locale>ja</supported-locale>
</locale-config>Now I launched my application on a browser set to 'en' language. In this case FacesContext.getCurrentInstance().getViewRoot().getLocale() indicates 'en' locale and when I set the browser locale to 'ja', FacesContext.getCurrentInstance().getViewRoot().getLocale() indicates 'ja' locale. Does this mean that FacesContext.getCurrentInstance().getViewRoot().getLocale() returns the locale of the browser? How do I programatically find the default locale of my application that was defined above (i.e. en)?
Thanks
Vishal
Hi
I want to show everything on my application in English.
I dont want to user f:view locale="en"
Also, i dont have any Java code where i case setLocale. I want to set at the time when my application is loading in the browser.
When i set it in faces-config, the browser locale over rides the value set in faces-config.
Is there a way by which i define the locale for my application and my browser dont override this value.
TIA
Edited by: 923867 on Apr 16, 2012 6:32 AM
Similar Messages
-
Maintaining default locale in multi-lingual application
Hello,
I have a multi-lingual application where the language can be changed at runtime.
To make the following code work properly, the default locale has to be set each
time the language changes. Why?
Since I need to check sometimes the platforms original locale (I do this with
"Locale.getDefault()"), I am looking for a way not to change the default locale,
but still to change the resourceBundle.
In the API I read under "ResourceBundle, Cache Management" that the bundles are cached. Is this the reason why redefining the resourceBundle has no effect? And if yes, how can it be avoided?
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
public class Y extends JFrame {
boolean toggle;
Locale currentLocale;
JButton b;
ResourceBundle languageBundle;
String country, userLanguage;
public Y() {
setSize(300,300);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
Container cp= getContentPane();
b= new JButton();
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
toggle= !toggle;
if (toggle)
country= "DE";
else
country= "GB";
setUserLanguage(country);
cp.add(b, BorderLayout.SOUTH);
setUserLanguage("GB");
setVisible(true);
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Y();
void setUserLanguage(String country) {
if (country.equals("DE"))
userLanguage= "de";
else
userLanguage= "en";
currentLocale = new Locale(userLanguage, country);
// System.out.println(currentLocale); // The locale changes ...
// Locale.setDefault(currentLocale); // Remove comment slashes and it works.
// languageBundle.clearCache(); // No effect.
languageBundle = ResourceBundle.getBundle("MyBundle",currentLocale);
System.out.println(languageBundle); // ... but the resourceBundle does not change.
b.setText(languageBundle.getString("ButtonText"));
The resource bundle files:
MyBundle.properties
ButtonText= Just a button
MyBundle_de_DE.properties
ButtonText= Nur ein KnopfEdited by: Joerg22 on 18.08.2008 13:26What's your default locale? If your default locale is de_DE, that's the expected behavior. The reason for it is the fallback mechanism searches default locale's bundle before falls back to the base bundle, i.e., in case of searching en_GB bundle, the search order is:
en_GB
en
de_DE
de
(base)
So, it will choose MyBundles_de_DE.
If you do not want this default locale fallback, you can specify ResourceBundle.Control instance, which is returned from ResourceBundle.Control.getNoFallbackControl() method, in your getBundle() call. Or if you do not use JDK6, you could copy the base bundle to MyBundles_en, which is ugly but should work.
Naoto
Edited by: naoto on Aug 18, 2008 1:05 PM -
I just installed 9.0.1 and it continually creates copies of C:\Documents and Settings\Catain Kirk\Local Settings\Application Data\Mozilla\Firefox\Profiles\afbrfhnj.default\Cache ... how do I stop it !!!
I'm running Windows XP Version 5.1 SP3.Hi,
That is the disk cache of Firefox, where contents of loaded pages are kept for faster retrieval and it also helps to conserve bandwidth. To disable this: '''Tools''' ('''Alt''' + '''T''') > '''Options''' > '''Advanced''' > '''Network''', check (tick) '''Override automatic cache management ''' and put the value at zero.
[https://support.mozilla.org/en-US/kb/Options%20window%20-%20Advanced%20panel?as=u#advanced_network Cache]
Useful links:
[https://support.mozilla.com/en-US/kb/Options%20window All about Tools > Options]
[http://kb.mozillazine.org/About:config Going beyond Tools > Options - about:config]
[http://kb.mozillazine.org/About:config_entries about:config Entries]
[https://support.mozilla.com/en-US/kb/Page%20Info%20window Page Info] Tools (Alt + T) > Page Info, Right-click > View Page Info
[https://support.mozilla.com/en-US/kb/Keyboard%20shortcuts Keyboard Shortcuts]
[https://support.mozilla.com/en-US/kb/Viewing%20video%20in%20Firefox%20without%20a%20plugin Viewing Video without Plugins]
[http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder & Files]
[https://developer.mozilla.org/en/Command_Line_Options#Browser Firefox Commands]
[https://support.mozilla.com/en-US/kb/Basic%20Troubleshooting Basic Troubleshooting]
[https://support.mozilla.com/en-US/kb/common-questions-after-upgrading-firefox-36 After Upgrading]
[https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode]
[http://kb.mozillazine.org/Problematic_extensions Problematic Extensions]
[https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes Troubleshooting Extensions and Themes]
[https://support.mozilla.com/en-US/kb/Troubleshooting%20plugins Troubleshooting Plugins]
[http://kb.mozillazine.org/Testing_plugins Testing Plugins] -
Xdg-open didn't read ~/.local/share/applications/default.list
xdg-open doesn't read ~/.local/share/applications/default.list, and the only way to associate application and filetype is do following command:
xdg-mime default thur.desktop inode/directory
But, the content of default.list will be rewrite.
xdg-open ignore everything I have added to default.list manually.
It looks like xdg-open have something like database to track association I added through command, then dump it to default.list after I execute the command.
Does anyone have idea what wrong happened? tell me please
Last edited by lanyitin800830 (2012-05-10 18:16:10)Update: This works (line 402 in /usr/bin/xdg-open):
---( From )---
$command_exec "$1"
---( To )---
eval `"$command_exec" "$1"`
At least for me, I get the expected behavior for pdfs (evince opens the file, nothing else) with this change. Is this a bug? -
Can I set the default locale for jvm
Hi,
Can I set the default locale for jvm?
How to do it?
PanMy windows default locale is chinese .I have thought of your opinion. But in
windows nt , if I change the locale , all the environment will be
destroyed(just like reinstall it , it's difficult for me) . So , Is there
any other approach?
Dimitri Rakitine <[email protected]> wrote in message
news:[email protected]...
Did you try to change the locale in the Windows control panel?
(Control panel -> Regional Options -> Your locale)
Pan YangBin <[email protected]> wrote:
I have tried changing this system property and other properties such
as -Duser.language=en -Dfile.encoding=Cp1252 , but all these properties
did
not changed, you can get this infomation from the log file .Maybe these
system properties are readonly.
Thanks very much.
Pan
Chris Halstead <[email protected]> wrote in message
news:[email protected]...
Try adding -Duser.region=US to the java command line used to start
WebLogic...
-chris
"Pan YangBin" <[email protected]> wrote in message
news:[email protected]...
Hi,
The problem exists in my project still exist.That is it.
When I did not set weblogic.jsp.encoding to GB2312 in my web
application(web.xml), and when the jsp file contain's chinese , the
output
will be error(error chinese) .And when I did not set it , the output
is
correct, but when I use request.getParameter("SomeFormElement")(theelement
inputed chinese), the return value is error(still chinese error).And
when
I
am in windows nt english version and do not set this property, all
these
two
problems dispear. And I try to compare the java files those were
generated
by weblogic from the jsp file , there is only two additional clause
in
the
java file. That's it:
((weblogic.servlet.jsp.JspWriterImpl)out).setEncoding("GB2312");
response.setHeader("Content-Type", "text/html; charset=GB2312");
(the web.xml has <context-param>
<param-name>weblogic.jsp.encoding</param-name>
<param-value>GB2312</param-value>
</context-param> to be set
So, I think maybe it works well if I change the default locale toenglish.
And unfortunately, your method is also failed.(I have to use weblogic
in
chinese environment)
Would you please help me to solve this problem?
Pan
Dimitri Rakitine <[email protected]> wrote in message
news:[email protected]...
Try java ... -Duser.language=en ...
or mode con cp select=437 in the command prompt before running
weblogic.
Pan YangBin <[email protected]> wrote:
I'm using weblogic server 5.1 sp6 in chinese environment, and I
want
weblogic compile my jsp with en_us locale . So I can't use
Locale.setDefault(new Locale(...)) to set the default locale ,butI
really
want someway configure.
Pan
Dimitri Rakitine <[email protected]> wrote in message
news:[email protected]...
Locale.setDefault(new Locale(...)) ?
Pan YangBin <[email protected]> wrote:
Hi,
Can I set the default locale for jvm?
How to do it?
PanDimitri
Dimitri
Dimitri -
Is there a way to set the Page/Print Scaling to a default at the application level? For Acrobat and Reader?
Thanks,Often asked, but that feature retains the last used local setting.
You can however, change the default for Documents, individually, in their Properties > Advanced tab -
Hello,
I want to change the default locale for my application and I set in faces-config the default language it. When I run my application the page it start with en - the default browser language.
How can I make to start my application with it?
Thank you.The locale of a JSF page is taken from the "locale" attribute of the <f:view> tag. If you do not specify a value for this attribute, then the JSF page's locale is determined based on the request's prefered locale (e.g. the list of supported locales specified in the browser's configuration) in conjunction with the locale configuration in faces-config.xml as follows:
1) If the request's prefered locale is configured as a supported locale in faces-config.xml, then it is used, otherwise go to (2);
2) If the request's prefered locale is "en", then it is used no mather if the locale "en" is configured as supported in faces-config.xml, otherwise go to (3);
3) If the request's prefered locale is neither supported nor it is "en", then the default locale configured in faces-config.xml is used.
As you can see, the step 2 of the algorithm is causing your problem. I am recommeding you to use the "locale" attribute of the <f:view> tag in order to workaround the problem. Note, that you should pass a Locale object to the "locale" attribute instead of some locale code.
Dimitar -
Default-locale setting is ignored!
Hi gurus,
i tried following:
<application>
<message-bundle>mymessagess</message-bundle>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
</application>
In my application the locale is still de.
What have i done wrong?
Or how can i set the local in faces-config?!?!?
Regards
WolleHi,
Have you tried it with the latest weekly build? You can find it at javaserverfaces.dev.java.net .
I think you are regarding to issue 8 which has been solved.
Greetings,
Romano -
Restrictions on local Java applications
Hello!
By java 2 security model, all local Java applications run unrestricted as trusted applications by default. but there is a note about security configuration which runs local application with access-control policies applied (similar to applet's and remote application's).
But there was not reference how this can be achieved.
Can you pointed me out how to configure such behaviour?
Thank you!Thank you, Martin!
I did just as stated in security policy documentation, but my policy does not apply to all (in fact to any) localy started application?
Is there a special trick to make it work? -
Simple question about disabling Swing default Locale
Hi.
I am trying to disable the Japanese messages that appear in JDialogs. I am using a Japanese version of WinXP.
How do I do this? It would be good to do it programmatically and be totally platform and locale independent. I am trying to set messages to English.
I tryed resetting the default locale, which seemed to change the default, but made absolutely no difference to my program.
Many thanks in advance.This code seems to change the keyboard itself to be US. That sounds pretty drastic. Would if affect other applications?
Perhaps you could explain a bit more about how JDialog knows what language to display its dialogs in. Why doesn't it work to change the locale of individual swing components? -
Before re-installing Firefox 19, I mistakenly took backup of my profile from a folder - C:\Documents and Settings\garan14\Local Settings\Application Data\Mozilla\Firefox\Profiles and not from C:\Documents and Settings\garan14\Application Data\Mozilla\Firefox\Profiles.
While installing, I selected "Delete the old profiles" option and I don't see any old profile folder under C:\Documents and Settings\garan14\Application Data\Mozilla\Firefox\Profiles.
However, I have a lot of important data saved under that profile which now has got deleted.
Is there any way I can still restore the data from old profile? (P.S.: As mentioned above, I have a back-up of profile folder which resides under Local Settings folder)
I am in a desperate need for the help. Pls reply as soon as possible.i have some problem. i delete firefox profile and i cannot use mozilla right now. can you help me ? thank you
-
How to set default locale in JDK1.3.0 to US?
Hi, everyone!
I found the default locale in JDK 1.3.0 is not set to US when I converted our JDK from 1.2 to 1.3.0. So I have to change code by passing Locale.US.
The output from below test code is:
default=��100.00
US=$100.00
import java.util.Locale;
import java.text.*;
public class TestCurrency
public static void main(String[] args)
int amount = 100;
//default
NumberFormat moneyWriter = NumberFormat.getCurrencyInstance();
System.out.println ("default=" + moneyWriter.format(amount) );
//US
moneyWriter = NumberFormat.getCurrencyInstance(Locale.US);
System.out.println ("US=" + moneyWriter.format(amount) );
Can anyone tell me how to set default locale in JDK 1.3.0 to US?
Thanks!You have to set something on your computer (outside Java) to tell it that you are in the US. You didn't say, but I'm going to guess that you are using Windows; if that's so, then try Regional Options in Control Panel.
-
Default locale support for texts datasources
Hi,
I faced with problem - does BW support default locales ?
I have some texts datasources which contain some list of entries for default locale. The question is - what value of LANGU field I should setup for these entries in order to BW recognize them as for default locales ?
Thanks. I will be apprecated for any related info.
Fiodar.Hi Fiodar,
well I am not sure about your requirement, but it sounds like you want to add a default value to langu in case the source system doesn't deliver it.
If this is the case, create a update routine in your transfer rules for 0langu. In the routine add the following coding:
if tran_structure-spras is initial. "no language specified
usually the R/3-field is called spras
result = sy-langu. "or a literal like 'EN' ...
else.
pass the given language to the result of the routine.
result = tran_structure-spras.
endif.
That's it.
In case your datasource doesn't even deliver a field for the language, you can just set a constant value to 0langu in your transfer rules.
regards
Siggi -
Where the Adobe Designer PDF Form "Default Locale" read from?
I am designing PDF form using Adobe Designer. I have set the "Default Locale" in the Edit -> Form Properties. I have set the Display Pattern of numeric field to ZZZ,ZZZ,ZZ9.99. Based on locale, Adobe should format the numeric field accordingly. So where exactly the Adobe Designer read the locale and the number format? From SAP table, Adobe server OS, PC OS or from where? Because I need to check the locale setting ZZZ,ZZZ,ZZ9.99, ZZZ.ZZZ.ZZ9,99 and so on.
Check in the Interface Or Form Builder -->Interface.
Reward if Useful.
Thanks,
Anita -
User.region and the default locale
What is the difference between user.region, user.country and the default locale.
ThanksSame problem here ! I called Apple Care and got two people during 2 hours on call, they were unable to explain why and just repeat that "the use of TVout for recording purpose are not supported by apple".
Why this settings has to be hidden ?
FYI : i'm able to capture Ipad 2 thru BMD Intensity Pro but not able to switch PAL and NTSC in TV OUT settings to get a correct input. TV OUT setting doesn't appear.
Maybe you are looking for
-
Bug with Overall Signature Validity Icon
I am finding that there are inconsistencies in the way Adobe Acrobat 9.0.0 and Adobe Reader 9.0.0 indicate Overall Signature Validity states for digitally signed documents. Adobe's white paper on this issue at http://www.adobe.com/devnet/reader/artic
-
Hi, I will be traveling to Canada and USA. (Meteor PAYG Samsung Trend Plus ) I am trying to find out if there is anything I need to do to make sure I can make and receive calls. Looking at Meteor website I understand it should work but it says the s
-
Deleting Application & Log Question
We had a consultant come and do training on location. I now have 3 training applications that I need to delete. They where created by three different people and when I log in as the admin to delete them, I am receiving the following message: " An err
-
I spent some time last night trying to implement a query having a LIKE expression as well as SKIP and TAKE expressions with parameter for Sql server 2000. I could not have Linq work for the LIKE expression, so I tried an Object query with LIKE, SKIP
-
Is that possible to build cube using STAGING FACT TABLE on Essbase ????? If yes, kindly guide me to do .... Thanks in advance, Mehar