function locale_schema

Same name in other branches
  1. 7.x modules/locale/locale.install \locale_schema()
  2. 9 core/modules/locale/locale.install \locale_schema()
  3. 8.9.x core/modules/locale/locale.install \locale_schema()
  4. 11.x core/modules/locale/locale.install \locale_schema()

Implements hook_schema().

File

core/modules/locale/locale.install, line 71

Code

function locale_schema() {
    $schema['locales_source'] = [
        'description' => 'List of English source strings.',
        'fields' => [
            'lid' => [
                'type' => 'serial',
                'not null' => TRUE,
                'description' => 'Unique identifier of this string.',
            ],
            'source' => [
                'type' => 'text',
                'mysql_type' => 'blob',
                'not null' => TRUE,
                'description' => 'The original string in English.',
            ],
            'context' => [
                'type' => 'varchar_ascii',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
                'description' => 'The context this string applies to.',
            ],
            'version' => [
                'type' => 'varchar_ascii',
                'length' => 20,
                'not null' => TRUE,
                'default' => 'none',
                'description' => 'Version of Drupal where the string was last used (for locales optimization).',
            ],
        ],
        'primary key' => [
            'lid',
        ],
        'indexes' => [
            'source_context' => [
                [
                    'source',
                    30,
                ],
                'context',
            ],
        ],
    ];
    $schema['locales_target'] = [
        'description' => 'Stores translated versions of strings.',
        'fields' => [
            'lid' => [
                'type' => 'int',
                'not null' => TRUE,
                'default' => 0,
                'description' => 'Source string ID. References {locales_source}.lid.',
            ],
            'translation' => [
                'type' => 'text',
                'mysql_type' => 'blob',
                'not null' => TRUE,
                'description' => 'Translation string value in this language.',
            ],
            'language' => [
                'type' => 'varchar_ascii',
                'length' => 12,
                'not null' => TRUE,
                'default' => '',
                'description' => 'Language code. References {language}.langcode.',
            ],
            'customized' => [
                'type' => 'int',
                'not null' => TRUE,
                // LOCALE_NOT_CUSTOMIZED
'default' => 0,
                'description' => 'Boolean indicating whether the translation is custom to this site.',
            ],
        ],
        'primary key' => [
            'language',
            'lid',
        ],
        'foreign keys' => [
            'locales_source' => [
                'table' => 'locales_source',
                'columns' => [
                    'lid' => 'lid',
                ],
            ],
        ],
        'indexes' => [
            'lid' => [
                'lid',
            ],
        ],
    ];
    $schema['locales_location'] = [
        'description' => 'Location information for source strings.',
        'fields' => [
            'lid' => [
                'type' => 'serial',
                'not null' => TRUE,
                'description' => 'Unique identifier of this location.',
            ],
            'sid' => [
                'type' => 'int',
                'not null' => TRUE,
                'description' => 'Unique identifier of this string.',
            ],
            'type' => [
                'type' => 'varchar_ascii',
                'length' => 50,
                'not null' => TRUE,
                'default' => '',
                'description' => 'The location type (file, config, path, etc).',
            ],
            'name' => [
                'type' => 'varchar',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
                'description' => 'Type dependent location information (file name, path, etc).',
            ],
            'version' => [
                'type' => 'varchar_ascii',
                'length' => 20,
                'not null' => TRUE,
                'default' => 'none',
                'description' => 'Version of Drupal where the location was found.',
            ],
        ],
        'primary key' => [
            'lid',
        ],
        'foreign keys' => [
            'locales_source' => [
                'table' => 'locales_source',
                'columns' => [
                    'sid' => 'lid',
                ],
            ],
        ],
        'indexes' => [
            'string_type' => [
                'sid',
                'type',
            ],
            'type_name' => [
                'type',
                'name',
            ],
        ],
    ];
    $schema['locale_file'] = [
        'description' => 'File import status information for interface translation files.',
        'fields' => [
            'project' => [
                'type' => 'varchar_ascii',
                'length' => '255',
                'not null' => TRUE,
                'default' => '',
                'description' => 'A unique short name to identify the project the file belongs to.',
            ],
            'langcode' => [
                'type' => 'varchar_ascii',
                'length' => '12',
                'not null' => TRUE,
                'default' => '',
                'description' => 'Language code of this translation. References {language}.langcode.',
            ],
            'filename' => [
                'type' => 'varchar',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
                'description' => 'Filename of the imported file.',
            ],
            'version' => [
                'type' => 'varchar',
                'length' => '128',
                'not null' => TRUE,
                'default' => '',
                'description' => 'Version tag of the imported file.',
            ],
            'uri' => [
                'type' => 'varchar',
                'length' => 255,
                'not null' => TRUE,
                'default' => '',
                'description' => 'URI of the remote file, the resulting local file or the locally imported file.',
            ],
            'timestamp' => [
                'type' => 'int',
                'not null' => FALSE,
                'default' => 0,
                'description' => 'Unix timestamp of the imported file.',
                'size' => 'big',
            ],
            'last_checked' => [
                '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.',
                'size' => 'big',
            ],
        ],
        'primary key' => [
            'project',
            'langcode',
        ],
    ];
    return $schema;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.