Implements hook_schema().
function locale_schema() {
$schema['locales_source'] = array(
'description' => 'List of English source strings.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Unique identifier of this string.',
),
'source' => array(
'type' => 'text',
'mysql_type' => 'blob',
'not null' => TRUE,
'description' => 'The original string in English.',
),
'context' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The context this string applies to.',
),
'version' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => 'none',
'description' => 'Version of Drupal where the string was last used (for locales optimization).',
),
),
'primary key' => array(
'lid',
),
'indexes' => array(
'source_context' => array(
array(
'source',
30,
),
'context',
),
),
);
$schema['locales_target'] = array(
'description' => 'Stores translated versions of strings.',
'fields' => array(
'lid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Source string ID. References {locales_source}.lid.',
),
'translation' => array(
'type' => 'text',
'mysql_type' => 'blob',
'not null' => TRUE,
'description' => 'Translation string value in this language.',
),
'language' => array(
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
'description' => 'Language code. References {language}.langcode.',
),
'customized' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
// LOCALE_NOT_CUSTOMIZED
'description' => 'Boolean indicating whether the translation is custom to this site.',
),
),
'primary key' => array(
'language',
'lid',
),
'foreign keys' => array(
'locales_source' => array(
'table' => 'locales_source',
'columns' => array(
'lid' => 'lid',
),
),
),
'indexes' => array(
'lid' => array(
'lid',
),
),
);
$schema['locales_location'] = array(
'description' => 'Location information for source strings.',
'fields' => array(
'lid' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'Unique identifier of this location.',
),
'sid' => array(
'type' => 'int',
'not null' => TRUE,
'description' => 'Unique identifier of this string.',
),
'type' => array(
'type' => 'varchar',
'length' => 50,
'not null' => TRUE,
'default' => '',
'description' => 'The location type (file, config, path, etc).',
),
'name' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Type dependent location information (file name, path, etc).',
),
'version' => array(
'type' => 'varchar',
'length' => 20,
'not null' => TRUE,
'default' => 'none',
'description' => 'Version of Drupal where the location was found.',
),
),
'primary key' => array(
'lid',
),
'foreign keys' => array(
'locales_source' => array(
'table' => 'locales_source',
'columns' => array(
'sid' => 'lid',
),
),
),
'indexes' => array(
'string_id' => array(
'sid',
),
'string_type' => array(
'sid',
'type',
),
),
);
$schema['locale_file'] = array(
'description' => 'File import status information for interface translation files.',
'fields' => array(
'project' => array(
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
'default' => '',
'description' => 'A unique short name to identify the project the file belongs to.',
),
'langcode' => array(
'type' => 'varchar',
'length' => '12',
'not null' => TRUE,
'default' => '',
'description' => 'Language code of this translation. References {language}.langcode.',
),
'filename' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'Filename of the imported file.',
),
'version' => array(
'type' => 'varchar',
'length' => '128',
'not null' => TRUE,
'default' => '',
'description' => 'Version tag of the imported file.',
),
'uri' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'URI of the remote file, the resulting local file or the locally imported file.',
),
'timestamp' => array(
'type' => 'int',
'not null' => FALSE,
'default' => 0,
'description' => 'Unix timestamp of the imported file.',
),
'last_checked' => array(
'type' => 'int',
'not null' => FALSE,
'default' => 0,
'description' => 'Unix timestamp of the last time this translation was confirmed to be the most recent release available.',
),
),
'primary key' => array(
'project',
'langcode',
),
);
$schema['locale_project'] = array(
'description' => 'Translation status information for projects and server data.',
'fields' => array(
'name' => array(
'description' => 'A unique short name to identify the project.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
),
'project_type' => array(
'description' => 'Project type: core, module, or theme.',
'type' => 'varchar',
'length' => 15,
'not null' => TRUE,
),
'core' => array(
// http://drupal.org/node/542202#core has an example.
'description' => 'Core compatibility string for this project, for example: 8.x',
'type' => 'varchar',
'length' => 4,
'not null' => TRUE,
'default' => '',
),
'version' => array(
// http://drupal.org/node/467026 has examples.
'description' => 'The version release of the project, for example: 8.x-2.1 or 8.x-1.0-dev',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'server_pattern' => array(
'description' => 'Pattern of path and name of the gettext file at the translation server.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'status' => array(
// locale.compare.inc gives possible values for status.
'description' => 'The status of the project. Possible values are: 1 = enabled, 0 = disabled.',
'type' => 'int',
'not null' => TRUE,
'default' => 1,
),
),
'primary key' => array(
'name',
),
);
return $schema;
}