drupal-6.locale.database.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <?php
  2. /**
  3. * Database additions for locale tests.
  4. */
  5. db_create_table('languages', array(
  6. 'fields' => array(
  7. 'language' => array(
  8. 'type' => 'varchar',
  9. 'length' => 12,
  10. 'not null' => TRUE,
  11. 'default' => '',
  12. ),
  13. 'name' => array(
  14. 'type' => 'varchar',
  15. 'length' => 64,
  16. 'not null' => TRUE,
  17. 'default' => '',
  18. ),
  19. 'native' => array(
  20. 'type' => 'varchar',
  21. 'length' => 64,
  22. 'not null' => TRUE,
  23. 'default' => '',
  24. ),
  25. 'direction' => array(
  26. 'type' => 'int',
  27. 'not null' => TRUE,
  28. 'default' => 0,
  29. ),
  30. 'enabled' => array(
  31. 'type' => 'int',
  32. 'not null' => TRUE,
  33. 'default' => 0,
  34. ),
  35. 'plurals' => array(
  36. 'type' => 'int',
  37. 'not null' => TRUE,
  38. 'default' => 0,
  39. ),
  40. 'formula' => array(
  41. 'type' => 'varchar',
  42. 'length' => 128,
  43. 'not null' => TRUE,
  44. 'default' => '',
  45. ),
  46. 'domain' => array(
  47. 'type' => 'varchar',
  48. 'length' => 128,
  49. 'not null' => TRUE,
  50. 'default' => '',
  51. ),
  52. 'prefix' => array(
  53. 'type' => 'varchar',
  54. 'length' => 128,
  55. 'not null' => TRUE,
  56. 'default' => '',
  57. ),
  58. 'weight' => array(
  59. 'type' => 'int',
  60. 'not null' => TRUE,
  61. 'default' => 0,
  62. ),
  63. 'javascript' => array(
  64. 'type' => 'varchar',
  65. 'length' => 32,
  66. 'not null' => TRUE,
  67. 'default' => '',
  68. ),
  69. ),
  70. 'primary key' => array(
  71. 'language',
  72. ),
  73. 'indexes' => array(
  74. 'list' => array(
  75. 'weight',
  76. 'name',
  77. ),
  78. ),
  79. 'module' => 'locale',
  80. 'name' => 'languages',
  81. ));
  82. db_insert('languages')->fields(array(
  83. 'language',
  84. 'name',
  85. 'native',
  86. 'direction',
  87. 'enabled',
  88. 'plurals',
  89. 'formula',
  90. 'domain',
  91. 'prefix',
  92. 'weight',
  93. 'javascript',
  94. ))
  95. ->values(array(
  96. 'language' => 'en',
  97. 'name' => 'English',
  98. 'native' => 'English',
  99. 'direction' => '0',
  100. 'enabled' => '1',
  101. 'plurals' => '0',
  102. 'formula' => '',
  103. 'domain' => 'http://en.example.com',
  104. 'prefix' => 'en',
  105. 'weight' => '0',
  106. 'javascript' => '',
  107. ))
  108. ->values(array(
  109. 'language' => 'fr',
  110. 'name' => 'French',
  111. 'native' => 'Français',
  112. 'direction' => '0',
  113. 'enabled' => '1',
  114. 'plurals' => '2',
  115. 'formula' => '($n>1)',
  116. 'domain' => '',
  117. 'prefix' => 'fr',
  118. 'weight' => '-3',
  119. 'javascript' => '51e92dcfe1491f4595b9df7f3b287753',
  120. ))
  121. ->execute();
  122. db_create_table('locales_source', array(
  123. 'fields' => array(
  124. 'lid' => array(
  125. 'type' => 'serial',
  126. 'not null' => TRUE,
  127. ),
  128. 'location' => array(
  129. 'type' => 'varchar',
  130. 'length' => 255,
  131. 'not null' => TRUE,
  132. 'default' => '',
  133. ),
  134. 'textgroup' => array(
  135. 'type' => 'varchar',
  136. 'length' => 255,
  137. 'not null' => TRUE,
  138. 'default' => 'default',
  139. ),
  140. 'source' => array(
  141. 'type' => 'text',
  142. 'mysql_type' => 'blob',
  143. 'not null' => TRUE,
  144. ),
  145. 'version' => array(
  146. 'type' => 'varchar',
  147. 'length' => 20,
  148. 'not null' => TRUE,
  149. 'default' => 'none',
  150. ),
  151. ),
  152. 'primary key' => array(
  153. 'lid',
  154. ),
  155. 'indexes' => array(
  156. 'source' => array(
  157. array(
  158. 'source',
  159. 30,
  160. ),
  161. ),
  162. ),
  163. 'module' => 'locale',
  164. 'name' => 'locales_source',
  165. ));
  166. db_create_table('locales_target', array(
  167. 'fields' => array(
  168. 'lid' => array(
  169. 'type' => 'int',
  170. 'not null' => TRUE,
  171. 'default' => 0,
  172. ),
  173. 'translation' => array(
  174. 'type' => 'text',
  175. 'mysql_type' => 'blob',
  176. 'not null' => TRUE,
  177. ),
  178. 'language' => array(
  179. 'type' => 'varchar',
  180. 'length' => 12,
  181. 'not null' => TRUE,
  182. 'default' => '',
  183. ),
  184. 'plid' => array(
  185. 'type' => 'int',
  186. 'not null' => TRUE,
  187. 'default' => 0,
  188. ),
  189. 'plural' => array(
  190. 'type' => 'int',
  191. 'not null' => TRUE,
  192. 'default' => 0,
  193. ),
  194. ),
  195. 'primary key' => array(
  196. 'language',
  197. 'lid',
  198. 'plural',
  199. ),
  200. 'indexes' => array(
  201. 'lid' => array(
  202. 'lid',
  203. ),
  204. 'plid' => array(
  205. 'plid',
  206. ),
  207. 'plural' => array(
  208. 'plural',
  209. ),
  210. ),
  211. 'module' => 'locale',
  212. 'name' => 'locales_target',
  213. ));
  214. // Enable the locale module.
  215. db_update('system')->fields(array(
  216. 'status' => 1,
  217. 'schema_version' => '6006',
  218. ))
  219. ->condition('type', 'module')
  220. ->condition('name', 'locale')
  221. ->execute();
  222. // Set the default language.
  223. db_insert('variable')->fields(array(
  224. 'name',
  225. 'value',
  226. ))
  227. ->values(array(
  228. 'name' => 'language_default',
  229. 'value' => 'O:8:"stdClass":11:{s:8:"language";s:2:"fr";s:4:"name";s:6:"French";s:6:"native";s:9:"Français";s:9:"direction";s:1:"0";s:7:"enabled";i:1;s:7:"plurals";s:1:"2";s:7:"formula";s:6:"($n>1)";s:6:"domain";s:0:"";s:6:"prefix";s:0:"";s:6:"weight";s:2:"-3";s:10:"javascript";s:32:"51e92dcfe1491f4595b9df7f3b287753";}',
  230. ))
  231. ->values(array(
  232. 'name' => 'language_count',
  233. 'value' => 'i:2;',
  234. ))
  235. ->values(array(
  236. 'name' => 'language_negotiation',
  237. 'value' => 'i:0;',
  238. ))
  239. ->execute();
  240. // Add the language switcher block in the left region.
  241. db_insert('blocks')->fields(array(
  242. 'module',
  243. 'delta',
  244. 'theme',
  245. 'status',
  246. 'weight',
  247. 'region',
  248. 'custom',
  249. 'throttle',
  250. 'visibility',
  251. 'pages',
  252. 'title',
  253. 'cache',
  254. ))
  255. ->values(array(
  256. 'module' => 'locale',
  257. 'delta' => '0',
  258. 'theme' => 'garland',
  259. 'status' => '1',
  260. 'weight' => '0',
  261. 'region' => 'left',
  262. 'custom' => '0',
  263. 'throttle' => '0',
  264. 'visibility' => '0',
  265. 'pages' => '',
  266. 'title' => '',
  267. 'cache' => '-1',
  268. ))
  269. ->execute();