You are here

Drupal专业开发指南 第23章 轮廓的存放位置

g089h515r806 的头像
Submitted by g089h515r806 on 星期五, 2009-09-04 11:20

你的Drupal站点已经包含了一个安装轮廓。它是Drupal自带的默认安装轮廓,位于profiles/default/default.profile。我们想创建一个新的名为“university”(大学)的轮廓,所以我们首先需要在profiles/university/university.profile创建一个新文件。现在,我们向这个文件中添加一个单独的函数:

 
<?php
// $Id$
/**
* Return a description of the profile for the initial installation screen.
*
* @return
* An array with keys 'name' and 'description' describing this profile,
* and optional 'language' to override the language selection for
* language-specific profiles, e.g., 'language' => 'fr'.
*/
function university_profile_details() {
    return array(
        'name' => 'Drupal (Customized for Iowa State University)',
        'description' => 'Select this profile to enable settings typical for a
            departmental website.',
    );
}
注意,这里文件的名称与轮廓目录的名称相同,而在文件名的后面则使用了.profile后缀,文件university.profile中的所有函数都以前缀university_开头。
 
由于安装轮廓的选择界面出现在本地化选择界面以前,所以无法翻译这里name和description键对应的字符串。然而,安装轮廓中的其它字符串,都需要使用函数st(),注意在这里不是使用通常的t()函数,这是因为安装器在运行这段代码时,Drupal还没有完成一个完整的引导指令,所以在这里不能使用t()函数。如果有人想为我们的安装轮廓创建一个法语翻译的话,那么翻译需要放在profiles/university/translations/fr.po中(参看第18章)。

Drupal版本: