Tuesday, October 5, 2010

Internationalization of ADF 11.1.1.3 Applications

In this Post I will explain you how to internationalize ADF 11.1.1.3 applications. ADF supports multiple language support which will be demonstrated here.

1) Open JDeveloper 11.1.1.3 and Create an Application and View Controller Project name it as sample.jpr

2) Create a new JSPX page called sample.jspx as follows.
Right Click on sample.jpr, select new--> JSF--> JSF Page --> Click OK

3) In the Create JSF Page Step, Give File Name as Sample.jspx, Make sure the Create an XML Document (*.jspx) option is checked also Do not Automatically Expose UI components in a Managed Bean is Checked.

3) You will see an empty sample.jspx page. Lets add some of the components to jspx page. Drag and drop the PanelStrechLayout Component on the page,


4) You will see number of facets like start, end, center etc on the page

5) Drag an drop the PanelGroupLayout on the center facet of the PanelStrechLayout.

6) set the Layout property of PanelGroupLayout to scroll as shown below

7) Create Resource bundle sampleUI.properties for english langauge and sampleUI_de.properties german langauge.

a) Right click on Sample.jpr and Create new---> General--> File ---> OK


b) Give FileName as sampleUI.properties and Click OK


c) Edit the SampleUI.properties as follows:

d) Create the sampleUI_de.properties to support german language.

e) edit the sampleUI_de.properties as follows:

8) Load the ResourceBundle property files created above in the sample.jspx as follows




9) Add inputText component on the PanelGroupLayout, edit the Label property and choose the expression builder and select the JSP Objects--> res --> sample.name --> Click OK

10) Add the Button Component just below the inputText and follow the above steps to set the Label property of the button.

11) Open the faces.config.xml, Under locale-config, set default locale to en and supported locale to de and save

12) Rebuild the project and Run the sample.jspx you will see by default english locale will be loaded and the page looks as follows

13) If you are using firefox mozilla browser go to Tools-->Options-->select content-->languages--> choose--> select german (de) langauge--> ok --> move this langauge up and click OK, refresh the browser to see the change.

22 comments:

  1. Is ADF internationalization supports for Indonesian language ?

    I have made the resourceBundle_id.properties and register it as Locale support in faces-config.xml. But when I change the language in web browser,It doesn't work.

    Do you have any idea ?

    ReplyDelete
  2. Yes, it supports Indonesian language...

    For Indonesian locale Use (in) not (id)...

    ReplyDelete
  3. Thanks Majid for the post, how to use the Internationalization independently from the browser ?

    ReplyDelete
  4. Hello Fakhri,

    Sorry for the delayed reply.

    You can use the internationalization independent of browser. Use the below code in your backing bean:

    private java.util.Locale locale = context.getViewRoot().getLocale();

    Object language="EN";
    locale=(java.util.Locale)language;
    FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);

    Best Regards
    Majid

    ReplyDelete
    Replies
    1. Can you show us with an example to do the internationalization with out browser settings? I am unable to use the above backing bean code

      Delete
    2. Hello Vinay,

      Why you are not able to use the above code in your backing bean?

      Are you getting any exception?

      Best Regards
      Majid Hussain

      Delete
    3. Hello
      I just use to above java code. But internationalization depend from browser. How to resolve independent of browser?
      thanks

      Delete
    4. Hello ajaxaa,

      You mean after using the above piece of code, do you need to change the locales from browser to load the internationalization changes...?

      Please note the above piece of code is an example of english locale. You need to change the code to support the other languages.

      For eg:

      private java.util.Locale locale = context.getViewRoot().getLocale();

      Object language="EN"; //Here i have hardcoded the language, you need to load this language object dynamically to support multiple locales.

      locale=(java.util.Locale)language;

      FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);


      Best Regards
      Majid Hussain

      Delete
  5. Awesome!

    Very clearly and very nicely explaind.

    Thanks for this.

    ReplyDelete
  6. Is ADF internationalization supports for Mongolian language ?

    ReplyDelete
  7. In the list of available documents there is not Mongolian language

    ReplyDelete
  8. Hello,

    Mangolian language should be supported.

    1) Create the sampleUI_mn.properties file and add the mangolian translations for all the labels.
    2) In faces.config.xml, Under locale-config, set default locale to en and supported locale to mn and save
    3) Build and deploy the changes. You can test by selecting the mangolian language from the firfox browser and load the application and check whether the mangolian translations are reflecting in your application...

    ReplyDelete
    Replies
    1. The af:inputDate component is not responding for Mongolian language.
      Label translations are working fine only problem with af:inputDate component

      Delete
  9. Nice one , very clear
    regards
    Palanivel

    ReplyDelete
  10. Hello. It depending browser settings. How to do not depend from browser? currently Change browser language then refresh my page.

    thanks

    ReplyDelete
  11. This tutorial works fine. Thank you so much!

    ReplyDelete
  12. Hai , I have doubt in 8 step pic,where what should we do that

    ReplyDelete
  13. Hi,

    Step8, is used to load the resource bundle file in your .jspx.
    Please refer f:loadbundle in the pic

    Best Regards
    Majid

    ReplyDelete
  14. hi,
    Is it possible to do Malayalam Language in oracle ADF in the multiple language for the translation?And what all the things to be done for the multiple language translation

    ReplyDelete
  15. Hi
    Im Using Jdev 12.1.3. I have an issue in adf multi language support. Followed this blog https://technology.amis.nl/2012/08/11/supporting-multiple-languages-in-adf-applications-backed-by-resource-bundles-and-p….
    The requirement is the application should support Arabic Language. In the above blog they have use database for translation For that i have created two .properties file(one for English that's default language and second one Arabic). But its not working. I want to know how the viewcontrollerbundle_ar.properties file is linked with the application and how to access that bundle file in the application

    ReplyDelete
  16. The af:inputDate component is not responding for Mongolian language.
    Label translations are working fine only problem with af:inputDate component

    ReplyDelete
  17. Quantum Binary Signals

    Get professional trading signals delivered to your mobile phone every day.

    Follow our signals NOW and earn up to 270% per day.

    ReplyDelete