[RSS]

FAQ: How can I set locale for VWP components?

There is not direct support in Nb 6.0.1, but you can set up it manually by steps bellow. It is useful for users who want their visualweb applications to run in other locales, whether for showing messages for certain languages or for showing time, date and other locale specific things.

  1. Create a new library
    • choose from main menu: Tools > Libraries
    • press the 'New Library ...' button
    • select 'Class Libraries' type and enter a name eg: WebUILocales
  2. Add localized JARs into the libary
    • NOTE: the localized JARs you can find at $NB_INST/visualweb1/modules/ext/locale, there are two JARs for each locale: webui-jsf-suntheme_$LOCALE.jar and webui-jsf_$LOCALE.jar
    • press the 'Add JAR/Folder ...' button
    • add localized JARs for all locales you wan to use
    • close the Library Manager
  3. Add the WebUILocales library into your project
    • right-click Libraries node under your project node
    • choose 'Add Library ....'
    • select the WebUILocales library from the list and press the 'Add Library' button
  4. Configure faces-config.xml
    • open 'Configuration Files/faces-config.xml' file
    • choose XML view
    • add (eg. directly under the root element) default and supported-locale info, so it will look like: <?xml version='1.0' encoding='UTF-8'?> <!-- =========== FULL CONFIGURATION FILE ================================== --> <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"> <application> <locale-config> <default-locale>$YOUR_LOCALE</default-locale> <supported-locale>$YOUR_OTHER_LOCALE</supported-locale> <supported-locale>en</supported-locale> </locale-config> </application> <! -- other parts of the faces-config.xml go below --> ...
    • save it and close the faces-config.xml
  5. Deploy & Test
    • build and deploy your project
    • set up correct locale in your browser
    • browse your pages (VWP components should be localized)

A sample, Japanese locale is used.

VWLocale.jpg

Attachments

VWLocale.jpg Info on VWLocale.jpg 73128 bytes