This discussion is archived
5 Replies Latest reply: Jan 17, 2013 3:36 AM by 939413 RSS

ADF Internationalization

fakhri.kharrat Newbie
Currently Being Moderated
hi,
i'm using jdev 11.1.2.3

I'm trying to set multi language in my project
I want to select the language from the beginning and independently of the browser lang

for that i created two files that contain all translate text in two languages

myerp.properties for english and myerp_fr.properties for frensh :


all.save=Save
all.cancel=Cancel
all.back=Back
all.first=First
all.next=Next
all.previous=Previous
all.last=Last

login.username=User Name
login.password=Password
login.button=Login
login.title=Login Form
index.dashboard=Dashboard

and for example i made reference in my text label : #{viewcontrollerBundle['login.username']}, when I refer to the ressouce bundle myerp for english there's a line created automatically in my page, and same thing when i refer to the resource bundle myerp_fr :

<c:set var="viewcontrollerBundle" value="#{adfBundle['myerp']}"/>
<c:set var="viewcontrollerBundle1" value="#{adfBundle['myerp_fr']}"/>

my question is how can i programmatically set a value of viewcontrollerBundle to adfBundle['myerp'] when i choose english language, when I login to my application, and adfBundle['myerp_fr'] if not


same thing for business layer, automatically created ModelBundle.properties, i did the same thing ModelBundle_fr.properties

so how can I do to make a language selection for model layer

Thanks

Edited by: fakhri_tn on Jan 16, 2013 1:37 AM
  • 1. Re: ADF Internationalization
    Santosh M E Explorer
    Currently Being Moderated
    Hi,

    Once you are login to home page, hope you are placing a dropdown list for lauguage change. For ex. select language is dropdown which will give option to change the other languages like English and French etc.
    Use value change Listner to implement the logic in a Bean method to change programatically based on selected language.


    -santosh
  • 2. Re: ADF Internationalization
    fakhri.kharrat Newbie
    Currently Being Moderated
    Thanks Santosh for your replay,

    i guess this but in my case all my pages contain these lines :
    <c:set var="viewcontrollerBundle" value="#{adfBundle['myerp']}"/>
    <c:set var="viewcontrollerBundle1" value="#{adfBundle['myerp_fr']}"/>

    so, i have to pass parameter to all my pages for the choice of the language or there's another solution, secondly do you have a sample code to implement this.

    thanks
  • 3. Re: ADF Internationalization
    Blueberry Coder Journeyer
    Currently Being Moderated
    See this: {message:id=10796100}

    Also, you could bind your dropdown list to an harcoded LOV listing the locales supported by your application. In order to do this, you create a simple View Object and define static values. You can find an example in the [url http://www.oracle.com/technetwork/developer-tools/jdev/index-098948.html]Summit ADF Sample. Make sure you deploy this VO through a Shared application module; that way, it will only be instantiated once.

    Best Regards,

    Frédéric.
  • 4. Re: ADF Internationalization
    fakhri.kharrat Newbie
    Currently Being Moderated
    any other suggestion ?
  • 5. Re: ADF Internationalization
    939413 Explorer
    Currently Being Moderated
    on the change of language, set the current language's locale in the faces Context and it will automatically pick up from the required resource bundle,for that locale :)
    FacesContext fc =FacesContext.getCurrentInstance();
    >fc.getViewRoot().setLocale(new Locale("en",countryCode));

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points