JSF 1.2: Locale specification

I gather that the java.util.Locale, java.text, etc only supports a handful of locales which do not include: Portuguese (pt), Spanish (es) , Dutch (nl), etc. Is there a way to include these locales in JDK 6 or should I wait for the official release of JDK 7?
Has anyone here been successful in implementing the above locales in JSF 1.2 - albeit that this might only be an issue with the JDK release?
I'm interested in hearing your feedback.

BalusC wrote:
Your problem lies somewhere else, I only don't understand it. Do you maybe mean the default message languages included in JSF? Just add your own.I'm sorry I wasn't clear, Bauke. Let me try to explain. I've got this in my faces-config.xml:
<locale-config>           
    <default-locale>en</default-locale>   
    <supported-locale>en</supported-locale>               
    <supported-locale>fr</supported-locale>
    <supported-locale>de</supported-locale>                    
    <supported-locale>it</supported-locale>
    <supported-locale>pt</supported-locale>
    <supported-locale>es</supported-locale>               
    <supported-locale>nl</supported-locale>
</locale-config>
<resource-bundle>
    <base-name>mypackage.i18n.MessageResources</base-name>
    <var>msg</var>
</resource-bundle>I have corresponding MessageResources property files to match the above locales: e.g. MessageResources_en.properties, etc. When I change the locale on my website the resource bundle loads successfully for all the locales above except for pt (Portuguese) and es (Spanish) - Sorry, nl (Dutch) is working now, my mistake.
I even tried hard coding it for testing my forms like so:
<f:view locale="pt">     // or
<f:view locale="pt_BR">  // or
<f:view locale="es">     // or
<f:view locale="es_ES">without success. (Of course, each time I changed the locale name, I also changed the corresponding MessageResources properties file to match.) Initially, I thought it was the Unicode characters (e.g. \u00f1, etc) in the resource bundles that may have caused certain locales to not load. However, the resource bundles for German (de), French (fr) and Italian (it) locales seem to load fine. So I rule out this as the cause of the problem.
I'm not sure what could prevent the Portuguese and Spanish locales not to display.
Edited by: icepax on 28/12/2009 18:12

Similar Messages

  • Validating locale specific numeric data.

    Is there is any way to validate a numeric value that can have scientific notation, plus/minus sign and locale specific decimal point.
    I tried using NumberFormat parse() method but it gives success even if the string is like 1erwrw. Any suggestions?

    Ok, Try this, I am getting Number parsed as output, but this is an ivalid number.
    public class test1
        public static void main(String[] args)
            try
                Number number = NumberFormat.getNumberInstance(Locale.ENGLISH).parse("12ee");
                System.out.println("Number parsed");
            catch (ParseException e1)
                e1.printStackTrace();
                System.out.println("Number cant be parsed");
    }

  • Best practice recommendation for locale-specific text/labels

    What is the recommended best practice approach to supporting locale-specific
    text for labels, messages when using Jdeveloper to create applets and applications.
    I am familiar with resource bundles, but wonder if there is a better approach within
    JDeveloper. Are there any plans to enhance this area in 9.0.3?

    I am familiar with resource bundles, but wonder if there is a better approach within
    JDeveloper. Resourcebundles are the java-native way of handling locale-specific texts.
    Are there any plans to enhance this area in 9.0.3? For BC4J, in 9.0.3, all control-hints and custom-validation messages (new feature) are generated in resource-bundles rather than xml-files to make it easier to "extend" for multiple locales.

  • When to use Locale specific data in HWC ?

    Working with a HWC application i noticed two other options as in screenshot  in the MBO screen (i.e Wrap data in PRE CODE and Locale -specific display ). When is the appropriate scenario to use these options?

    I never tried this but you may look at here:
    Wrap header in PRE : SyBooks Online
    Locale Specific : SyBooks Online

  • Locale-specific JSP page

    Hi,
    I want to provide internationalization in my web tier by providing locale-specific JSP pages rather than using resource bundles for the content inside the JSP page.
    In other words, I'd like to have a folder structure such that I have a default .jsp file in the root folder and locale-specific .jsp files under the locale folders as following:
      /jsp
          /index.jsp
          /en_US/
                 index.jsp
          /en_GB/
                 index.jspAnd depending on the default locale of the server (not user's). I'd like the appropriate index.jsp to be picked up at runtime.
    If the above is not possible, I even wouldn't mind using a locale suffix for the JSP files:
      /jsp
          /index.jsp
          /index_en_US.jsp
          /index_en_GB.jspIs there any way to do this?
    Thanks, Rishabh

    Well yeah, I did want the server to pick up the "best fit" JSP page automatically, going from specific to general. So if /en_US/index.jsp is missing, it should default to /index.jspSomewhat like how ResourceBundle handles property files.
    This approach is suggested in the Designing Enterprise Applications with the J2EE Platform book in the J2EE Internalization and Localization (http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/i18n/i18n4.html) section 10.3.3.5 - Locale-Specific JSP Pages. Of course here they use the users's locale from the request to do this. But using the default locale of the server should pretty much be the same thing.
    If the above doesn't really work, can anyone suggest how I can hook into the request handler or write a custom servlet filter as suggested by Ram to do this at a framework level so that it works for all my pages?
    Thanks, Rishabh

  • Multilanguage JRE6 still inserts non-locale specific .msi

    If I run (locallly) the multi-language jre-6-windows-i586.exe against a French (France) Windows OS, the resultant .msi (Docs & Settings\App data....) is still English (1033).
    I need the locale specific .msi for GP deployment. Any help??

    Driver is said to not work with Xorg server 1.7, see http://aur.archlinux.org/packages.php?ID=31995
    There is new IEGD driver out there in the wild, but currently only in the form of some Ubuntu mega kernel patch. See http://www.fit-pc2.com/forum/viewtopic.php?f=46&t=1322 and support my request there with your own voice! So we can adopt IEGD driver to Arch Linux!
    Last edited by ypnos (2010-01-24 14:04:18)

  • Double.parseDouble() is not Locale specific, how do I get round this?

    I am parsing Strings into doubles using
    String myNumber = "12,34";
    double d = Double.parseDouble( myNumber );The problem is that my number is of French style (it has commas instead of fullstops for the decimal points)
    The default Locale is English, so I get NumberFormat problems when parsing. (I can understand this)
    I even get NumberFormat problems when I do this:
    Locale.setDefault(Locale.FRENCH);
    double d = Double.parseDouble( myNumber );Which I think is really strange. I guess the Locale of Double is set at a certain time and not reset.
    OR maybe Double.parseDouble( <STRING> ); is not Locale specific?
    Where is my understanding wrong?

    Do you know if DecimalFormat reflects the default Locale if the default Locale changes?
    Or will I have to make a new DecimalFormat whenever it changes?As Locale is invariant, a DecimalFormat instance (as well a any object with a reference to the default Locale) cannot reflect the default Locale changes.
    But each time you create a new instance of DecimalFormat without specifying the Locale, it will get up-to-date Locale.
    However, you might prefer setting the locale explicitely (instead of changing the default one.)
    Note that Double valueOf() or parseDouble() methods are not related to default Locale, they use a fixed format.

  • Language/Locale specific text search

    We have a requirement for locale specific search. So when the user searches for anything in a particular locale it should only return the rows applicable in that locale. Have tried the language parameter in the query text but it is also returning the english rows if it finds the word in the english text. So, is there a way to be able to search only the specific locale using the language parameter so that we can use the stoplist functionality.

    Hi,
    you should use lexer which (BASIC_LEXER, MULTI_LEXER, ...) you need. Please see too this procedure ctx_ddl.add_sub_lexer in Text Reference.
    dap

  • Providing locale specific URL for navigation bar entry

    Hi,
    I am using APEX 3.0 on 10gR2 and 9.0.4 app server... I have successfully translated my application, with the exception of navigation bar entry URLs...
    The XLIFF export does not contain entries for the navbar entry URLs, only the labels. I have locale specific URLs for navbar entries (ie french URL, english URL)
    I can't seem to find any information on how to accomplish this... other than removing the navbar, and hard-coding them in the page template...
    Thanks for the help!

    Hi,
    as a workaround. The export will probably never work, because a URL isn't normally considered as language dependent.
    Have you already tried to write the different URLs into application items (which you initialize during login of the user) and reference them in the URL with &YOUR_APPLICATION_ITEM.Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

  • Local-specific currency editor for JSpinner

    I found this code a while back that creates a locale-specific currency editor that I can set for a JSpinner. (see below)
    Problem is that while the arrows follow the bounds set by the model, the user is allowed to type an invalid value in the text field and the model takes it.
    I don't want to make the editor read-only...how do I make it force staying in the bounds of the model?
    public static class CurrencyEditor extends DefaultEditor {
         public static final long serialVersionUID = 1L;
         public CurrencyEditor(JSpinner spinner) {
             super(spinner);
             final JFormattedTextField ftf = getTextField();
             ftf.setEditable(true);
             ftf.setFormatterFactory(new DefaultFormatterFactory(
                  new CurrencyFormatter()));
             ftf.setHorizontalAlignment(SwingConstants.RIGHT);
         private class CurrencyFormatter extends
              JFormattedTextField.AbstractFormatter {
             public static final long serialVersionUID = 1L;
             public String valueToString(Object object) {
              if (object == null) {
                  return "";
              NumberFormat curFormat = NumberFormat.getCurrencyInstance();
              return curFormat.format(object);
             public Object stringToValue(String string) throws ParseException {
              if (string == null || string.trim().length() == 0) {
                  return null;
              Number number = null;
              NumberFormat curFormat = NumberFormat.getCurrencyInstance();
              NumberFormat numFormat = NumberFormat.getNumberInstance();
              try {
                  number = curFormat.parse(string);
              } catch (ParseException ex) {
                  try {
                   number = numFormat.parse(string);
                  } catch (ParseException ex2) {
                   throw ex2;
              return number.doubleValue();
        }

    Alright...so SpinnerNumberModel doesn't validate...so, somehow, I guess I have to force my custom editor to validate before applying.

  • Locale specific time

    Hi Readers,
    Pls., helpout ! am trying to get the current date and time depending upon the Locale object.
    Its known that depeding upon the timezone with particular Locale we can get the specific time particuler that Locale and timezone.
    I need to provide an API where user this as
    public String getCurrentDateTime1(Locale alocale, String pattern) { }
    mine cincern is how to get hte timezone as per the lOcale object passed.
    Mine current implimentation is like this where am getting same system time
    public String getCurrentDateTime1(Locale alocale, String pattern)
    //Calendar now = new GregorianCalendar(alocale);
    Calendar now = Calendar.getInstance(alocale);
    java.util.Date localeDate = now.getTime();
    SimpleDateFormat formatter = new SimpleDateFormat (pattern);
    String dateString = formatter.format(localeDate);
    return dateString;
    Can any body help to get the corresponding timezone to locale passed.

    How to get the timezone from the locale object
    passed, is it possible to do so or any alternative
    ways to get the timezone as per locale.There is a locale named Locale.US. Find out what it represents. Next, find out how many different timezones there are in that place. Are there more than one? If so, what does that tell you about the answer to your question?

  • Getting locale specific date and time

    Hi,
    I am tyring to create a program which will display the current date and time for a specific locale. But I am clueless as to how to proceed.
    Please help me.
    Thanks

    examples:
    servers and protocols: http://tf.nist.gov/service/its.htm
    a simple java client using the daytime protocol: http://www.cafeaulait.org/course/week12/18.html
    (u can use the simpledateformat class to parse the output string to a java date)

  • SimpleDateFormatt vs Dateformat .Locale specific confusion

    Hello,
    I am implementing a date/time customization module in which the desired functionality commited to customer is : From a list of date/time patterns , customer choose a pattern he wish to see. Using that pattern , I will ve to display the date as per pattern selected by cust.
    I am pretty happy with simpledateformat custructors and also achieved the same. But when I read java doc for SimpleDateFormat(String pattern, Locale locale) , I am bit worried.
    java.text.SimpleDateFormat.SimpleDateFormat(String pattern, Locale locale)
    Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the given locale. Note: *This constructor may not support all locales.* For full coverage, use the factory methods in the DateFormat class. The bold line is creating a worry for me . Can any one plz tell me how to use the factory methods to achieve my requirment ? B'coz in DateFormat class , short,med,long are only 3 options for date customization. And I have very specific customization req which  short,med,long  cannt satisfy.
    Plz put some light on *This constructor may not support all locales.* For full coverage, use the factory methods in the DateFormat class.

    Why are you even bothering with Locale when you say the user will select the format they want?

  • JSF RE-Rendering a specific Component

    hey guys,
    need a bit of help here... I am doing a JSF Page.. where a person selects a vehicle type (vehicle he wants to book for... as in a chauffeurs service) the two options he can choose from are - limo and sedan.
    now as per the choice i need to populate a f:oneSelectMenu.... with available models. say if the person picks up a limo.. then the menu should only show limo models but not sedan's.
    for this i have already put up a listener on the f:selectOneRadio that offers the choice of two types of vehicles. as the person selects any type the listener populates a variable... and a backing bean that fetches the data from the database and populates the f:selectItems... that should go ii the f:selectOneMenu.
    everything till here is fine... even i an populate the f:selectItems in the backingbean. But as this is all in the same page.... i want my f:selectOneMenu to re-render so that it can pick those f:selectItems to show the desired data.
    I have struggled a lot searching on google.. but did not get any relevant solution for this prob.
    Could anyone please help me with this.. It would be great help....
    Regards

    Thanks for your reply sir...
    and yes i would like to do it async. what I want is as soon as the user choses a particular value using the :selectOneRadio, the values in the f:selectOneMenu should be populated accordingly.... both of these components are on the same page. and yes without hitting submit...
    Ok is there a way.. to refresh the whole page... using the valueChangeListener? or something equivalent? anything frm the bean?
    Regards

  • Requirement of Locale Specific Code in sorting

    I need to sort a list of items that can come in different languages. Do I require to use any Locale Object with it somewhere?
    Wont that be automatically taken care by java as it is done on the basis of Unicode characters(i believe). Please help me.

    See java.text.Collator

Maybe you are looking for