Jump to content
We've recently updated our Privacy Statement, available here ×

i18n with dynamic key


Recommended Posts

By: raffimd - raffimd

i18n with dynamic key

2006-04-04 23:33

Hi,

I browsed the already existing mails in the form, could not figure out the solution.

In my case, the values of a particular column are stored as 0,1,2, etc...

Example: OBJECTS

OBJ_TYPE OBJ_NAME

0 ABC

1 XYZ

2 STU

 

This column has to be localized based on the client locale. So, i have the following entries in the resource bundle

OBJECTS=OBJECTS

OBJ_TYPE_0=VEHICLE

OBJ_TYPE_1=HOUSE

OBJ_TYPE_2=ANIMALS

 

Now, when i get the data based on the query

"select OBJ_TYPE, OBJ_NAME from OBJECTS"

i get the values stored in the db. I need to convert the 0,1,2... into the respective values from the catalog.

So i need to add the prefix as "OBJ_TYPE_" with the 0,1,2...

I could not manipulate the key for $R{}

I could get the value if i use $R{OBJECTS}, but i don't know how to use $R{} with the dynamic key by adding prefix with the fileds in the resultset.

I have to do something like

$R{"OBJ_TYPE_" + $F{OBJ_TYPE}}, but it looks like this is not the correct format.

I tried the one more format:

After adding one more mapping in the resource bundle: OBJ_TYPE_PREFIX=OBJ_TYPE_

 

$R{$R{OBJ_TYPE_PREFIX} + $F{OBJ_TYPE}}

This also didn't work :-(

Can anyone tell me how to do it?

 

Thanks in Advance.

Raffi

 

 

 

 

By: Lucian Chirita - lucianc

RE: i18n with dynamic key

2006-04-07 05:52

Hi

 

You can use the built-in str function:

str("OBJ_TYPE_" + $F{OBJ_TYPE})

 

HTH,

Lucian

 

 

 

 

By: raffimd - raffimd

RE: i18n with dynamic key

2006-04-09 23:38

Hi Lucian,

It worked perfectly.

Thanks a lot :-)

Raffi

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...