2011-09-22 73 views
0

我创建了一个自定义模块,使我可以将国家添加到数据库中的自定义表。我会稍后再做,但因为我一开始就卡住了,我无法继续。Drupal 7:使自定义内容可翻译

首先我的一段代码:

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; 
} 

上面的代码生成我的数据库中的表。搜索后,我发现我可以将'translatable' => true添加到我的模式,所以Drupal知道这个字段是可翻译的内容。

我已经添加了一个表单,将数据插入该模式,但现在我卡住了。我需要做什么,用户能够翻译列name

感谢您的帮助。

回答

0

看看在this post上接受的答案,它应该有助于清除一些事情。

+0

所以它是核心,但它还没有做任何事情。 –