0

I've installed i18n module for taxonomy translation,and I have set in translatable mode. What I need is to have a form with some checkboxes in a multilingual site.

enter image description here

I'm able to obtain that checkboxes options, and I can see in my site in spanish and in basque. enter image description here The problem is that for example, in my spanish site if I select some of the options and save it, when I want to edit the values I'm able to see the selected options in the spanish site but not in the basque one.

What I do is to optain first the options this way:

$query = "SELECT name, tid FROM taxonomy_term_data WHERE vid=2 AND language = '$language_url';";
    $result = db_query($query);
    foreach ($result as $row2) {

    $options2[$row2->tid] = t($row2->name);
    }

Then obtain the selected values and set in the default value:

foreach ($node->field_municipio[LANGUAGE_NONE] as $delta => $value ) {

     $term2  = taxonomy_term_load($value['tid']);
     $datos[$term2->tid]=$term2->name;
    }

    $form['municipios'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Municipios'),
    '#options' => $options2,
    '#required' => TRUE,
    '#multiple'=>TRUE,
    '#default_value'=> array_keys($datos),
    /*'#prefix' => '<p>',
    '#suffix' => '<br></p>',*/
    );**

I suppose that I'm doing wrong doing a taxonomy_term_load, because I obtain only the selected options of the spanish site, but how can I know what is the translation of that value in basque??

I hope you can help me.

Thank you in advanced.

0

I recommend you to use Entity Translation instead of i18n. With Entity Translation each entity has its translation attached to the entity while i18n tends to crate new entities that are related (for example, two nodes related, each one for each language). This makes harder to manage all the translations for a piece of content.

For translating the term label you may need the Title module, I don't remember well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.