2 // $Id: locale.install,v 1.7 2006/11/14 06:20:40 drumm Exp $
5 * Implementation of hook_install().
7 function locale_install() {
8 // locales_source.source and locales_target.target are not used as binary
9 // fields; non-MySQL database servers need to ensure the field type is text
10 // and that LIKE produces a case-sensitive comparison.
11 switch ($GLOBALS['db_type']) {
14 db_query("CREATE TABLE {locales_meta} (
15 locale varchar(12) NOT NULL default '',
16 name varchar(64) NOT NULL default '',
17 enabled int NOT NULL default '0',
18 isdefault int NOT NULL default '0',
19 plurals int NOT NULL default '0',
20 formula varchar(128) NOT NULL default '',
22 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
24 db_query("CREATE TABLE {locales_source} (
25 lid int NOT NULL auto_increment,
26 location varchar(255) NOT NULL default '',
29 KEY source (source(30))
30 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
32 db_query("CREATE TABLE {locales_target} (
33 lid int NOT NULL default '0',
34 translation blob NOT NULL,
35 locale varchar(12) NOT NULL default '',
36 plid int NOT NULL default '0',
37 plural int NOT NULL default '0',
42 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
46 db_query("CREATE TABLE {locales_meta} (
47 locale varchar(12) NOT NULL default '',
48 name varchar(64) NOT NULL default '',
49 enabled int NOT NULL default '0',
50 isdefault int NOT NULL default '0',
51 plurals int NOT NULL default '0',
52 formula varchar(128) NOT NULL default '',
56 db_query("CREATE TABLE {locales_source} (
58 location varchar(255) NOT NULL default '',
63 db_query("CREATE TABLE {locales_target} (
64 lid int NOT NULL default '0',
65 translation text NOT NULL,
66 locale varchar(12) NOT NULL default '',
67 plid int NOT NULL default '0',
68 plural int NOT NULL default '0'
70 db_query("CREATE INDEX {locales_target}_lid_idx ON {locales_target} (lid)");
71 db_query("CREATE INDEX {locales_target}_locale_idx ON {locales_target} (locale)");
72 db_query("CREATE INDEX {locales_target}_plid_idx ON {locales_target} (plid)");
73 db_query("CREATE INDEX {locales_target}_plural_idx ON {locales_target} (plural)");
74 db_query("CREATE INDEX {locales_source}_source_idx ON {locales_source} (source)");
77 db_query("INSERT INTO {locales_meta} (locale, name, enabled, isdefault) VALUES ('en', 'English', '1', '1')");
81 * Implementation of hook_uninstall().
83 function locale_uninstall() {
84 db_query('DROP TABLE {locales_meta}');
85 db_query('DROP TABLE {locales_source}');
86 db_query('DROP TABLE {locales_target}');