views:

42

answers:

3

Hi, in the backend a user can select a country via dropdown menu, e.g. "Germany". The frontend is bilingual so i have to dump "Germany" if language A is set and "Deutschland" if language B is set.

How can i save the selection and its translation to separate fields in the database?

Thank you for any help!

A: 

You can have a lookup value for the Name for each language. Once the selected value is retrieved, you can make a lookup. Otherwise, in the codebehind, get the SelectedItem and SelectedValue to get both of them.

Kangkan
With "lookup value" you mean 1 = Germany/Deutschland, 2 = France/Frankreich ...That results in a lot of if statements in the frontend, doesn't it? Like: if lang=en and value=1 echo Germany ...I'm worried about the performance.Could you shortly explain how to get both the SelectedItem and the value? Thank you!
Christoph
A: 

you can use a array where you save the multilingual query and pick the value you like to use. or use a id like

1 for germany,deutschland,etc 2 for usa,america etc 3 for uk,england etc

<--- name="contry" value="1"> Germany </>

or

<--- name="contry" value="1"> Deutsch </>
Jaison Justus
Thanks, using an array works fine!
Christoph
A: 

Thanks, I did it as follows:

BACKEND:

<select name="country">
<option value="Deutschland:Germany">Deutschland</option>
<option value="Frankreich:France">Frankreich</option>
...
</select>

FRONTEND:

$countries = explode(':', $country);
$country_de = $countries[0];
$country_en = $countries[1];
Christoph