[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
language management via resource binding  XML
Forum Index -> Development
Author Message
kretzler

Power User

Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline

Hello,

I try to implement the language management via resource binding.

Within the jsp files I am using something like '#{rr.literals.link_overview}'. This works fine.

Is it also possible to set the value of a component in java and this value is then translated?

My first try was
public String getMessage() {
return "#{rr.literals.link_overview}";
}

and my second
public String getMessage() {
ResourceBundle rb = ResourceBundle.getBundle(
"org.eclnt.jsfserver.i18n.resources.Literals",
FacesContext.getCurrentInstance().getViewRoot().getLocale());
return rb.getString("rr.literals.link_overview");
}


Or isnt this possible and I have to follow the instructions in the chapter 'Doing it on your own...'


Thanks,
Ralph


p.s. it seems that if a key within a property file has a '.' the text is not shown on the surface.
msg.onLogin=Login // not working
msg_onLogin= Login //works fine
[WWW]
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5520
Offline

Hi,

you can access the info which is accessible by #{rr.xxx.yyy} from Java by:

ResourceManager.getRuntimeInstance().readProperty("xxx","yyy");

This does an access to ResourceBundel internally, similar to what your getMessage() looks like.

Well, the usage of "." is not preferrable, because this is separates the properties within an expression. You could use #{rr.literals["abc.def"]} as expression, but I would just not do it. No "." inside ids, they just make things condfusing...!

Björn

Björn Müller, CaptainCasa GmbH
kretzler

Power User

Joined: 21/11/2007 13:00:57
Messages: 73
Location: Karlsruhe
Offline

... works fine.

Thanks,
Ralph
[WWW]
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team