Search code examples
drupaldrupal-7translate

Drupal 7: Make custom content translatable


I'm creating a custom module which enables me to add Countries to a custom table in the database. I'll do later more with it, but as I got stuck at the beginning, I can't go on.

First my piece of code:

function partners_schema()
{
    $schema['partners_country'] = array(
        'description' => 'TODO: please describe this table!',
        'fields' => array(
            'id' => array(
                'description' => 'auto inc id of country',
                'type' => 'serial',
                'not null' => true,
            ),
            'name' => array(
                'description' => 'name of country',
                'type' => 'varchar',
                'length' => '255',
                'not null' => true,
                'translatable' => true,
            ),
            'needDistributor' => array(
                'description' => 'is a distributor needed',
                'type' => 'int',
                'size' => 'tiny',
                'not null' => true,
            ),
        ),
        'primary key' => array('id'),
    );

    return $schema;
}

The code above generates my Database table. After searching I found that I can add 'translatable' => true to my schema, so Drupal knows that this field is translatable content.

I've added a form, to insert data into that schema, but now I got stuck. What do I have to do, that the user is able to translate the column name?

Thanks for your help.


Solution

  • Have a look at the accepted answer on this post it should help clear a few things up.