Improve i18n by installing all available language packs on install

+ unb0rk the mysql schema ;)


git-svn-id: file:///svn/phpbb/trunk@6113 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-06-21 20:18:02 +00:00
parent 8dbef23cea
commit daa0435614
3 changed files with 47 additions and 15 deletions

View file

@ -87,6 +87,7 @@ class install_install extends module
case 'final' : case 'final' :
$this->load_schema($mode, $sub); $this->load_schema($mode, $sub);
$this->add_modules($mode, $sub); $this->add_modules($mode, $sub);
$this->add_language($mode, $sub);
$this->add_bots($mode, $sub); $this->add_bots($mode, $sub);
$this->email_admin($mode, $sub); $this->email_admin($mode, $sub);
@ -1354,6 +1355,40 @@ class install_install extends module
} }
} }
/**
* Populate the language tables
*/
function add_language($mode, $sub)
{
global $db, $lang, $phpbb_root_path, $phpEx;
$dir = @opendir($phpbb_root_path . 'language');
while (($file = readdir($dir)) !== false)
{
$path = $phpbb_root_path . 'language/' . $file;
if (is_dir($path) && !is_link($path) && file_exists($path . '/iso.txt'))
{
$lang_pack = file("{$phpbb_root_path}language/$path/iso.txt");
$sql_ary = array(
'lang_iso' => basename($path),
'lang_dir' => basename($path),
'lang_english_name' => trim(htmlspecialchars($lang_pack[0])),
'lang_local_name' => trim(htmlspecialchars($lang_pack[1])),
'lang_author' => trim(htmlspecialchars($lang_pack[2])),
);
$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
if ($db->sql_error_triggered)
{
$error = $db->sql_error($db->sql_error_sql);
$this->p_master->db_error($error['message'], $db->sql_error_sql, __LINE__, __FILE__);
}
}
}
}
/** /**
* Add search robots to the database * Add search robots to the database
*/ */

View file

@ -195,9 +195,9 @@ CREATE TABLE phpbb_extension_groups (
# Table: 'phpbb_forums' # Table: 'phpbb_forums'
CREATE TABLE phpbb_forums ( CREATE TABLE phpbb_forums (
forum_id smallint(5) UNSIGNED NOT NULL auto_increment, forum_id smallint(5) UNSIGNED NOT NULL auto_increment,
parent_id smallint(5) DEFAULT '0' UNSIGNED NOT NULL, parent_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
left_id smallint(5) DEFAULT '0' UNSIGNED NOT NULL, left_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
right_id smallint(5) DEFAULT '0' UNSIGNED NOT NULL, right_id smallint(5) UNSIGNED DEFAULT '0' NOT NULL,
forum_parents text, forum_parents text,
forum_name text, forum_name text,
forum_desc text, forum_desc text,
@ -227,8 +227,8 @@ CREATE TABLE phpbb_forums (
enable_icons tinyint(1) DEFAULT '1' NOT NULL, enable_icons tinyint(1) DEFAULT '1' NOT NULL,
enable_prune tinyint(1) DEFAULT '0' NOT NULL, enable_prune tinyint(1) DEFAULT '0' NOT NULL,
prune_next int(11) UNSIGNED, prune_next int(11) UNSIGNED,
prune_days tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, prune_days tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
prune_viewed tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, prune_viewed tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
prune_freq tinyint(4) UNSIGNED DEFAULT '0' NOT NULL, prune_freq tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
PRIMARY KEY (forum_id), PRIMARY KEY (forum_id),
KEY left_right_id (left_id, right_id), KEY left_right_id (left_id, right_id),
@ -289,9 +289,9 @@ CREATE TABLE phpbb_groups (
CREATE TABLE phpbb_icons ( CREATE TABLE phpbb_icons (
icons_id tinyint(4) UNSIGNED NOT NULL auto_increment, icons_id tinyint(4) UNSIGNED NOT NULL auto_increment,
icons_url varchar(255), icons_url varchar(255),
icons_width tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, icons_width tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
icons_height tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, icons_height tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
icons_order tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, icons_order tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
PRIMARY KEY (icons_id) PRIMARY KEY (icons_id)
); );
@ -329,7 +329,7 @@ CREATE TABLE phpbb_log (
# Table: 'phpbb_moderator_cache' # Table: 'phpbb_moderator_cache'
CREATE TABLE phpbb_moderator_cache ( CREATE TABLE phpbb_moderator_cache (
forum_id mediumint(8) DEFAULT '0' UNSIGNED NOT NULL, forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
username varchar(255) DEFAULT '' NOT NULL, username varchar(255) DEFAULT '' NOT NULL,
group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, group_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
@ -637,9 +637,9 @@ CREATE TABLE phpbb_smilies (
code varchar(50), code varchar(50),
emotion varchar(50), emotion varchar(50),
smiley_url varchar(50), smiley_url varchar(50),
smiley_width tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, smiley_width tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
smiley_height tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, smiley_height tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
smiley_order tinyint(4) DEFAULT '0' UNSIGNED NOT NULL, smiley_order tinyint(4) UNSIGNED DEFAULT '0' NOT NULL,
display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL, display_on_posting tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
PRIMARY KEY (smiley_id) PRIMARY KEY (smiley_id)
); );

View file

@ -389,9 +389,6 @@ INSERT INTO phpbb_styles_template (template_name, template_copyright, template_p
# -- phpbb_styles_theme # -- phpbb_styles_theme
INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_data) VALUES ('subSilver', '© phpBB Group', 'subSilver', ''); INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_data) VALUES ('subSilver', '© phpBB Group', 'subSilver', '');
# -- Language
INSERT INTO phpbb_lang (lang_iso, lang_dir, lang_english_name, lang_local_name, lang_author) VALUES ('en', 'en', 'English [ GB ]', 'English [ GB ]', 'phpBB Group');
# -- Forums # -- Forums
INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('My first Category', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 972086460, '', '', '', '', '', '', '', 0, 0); INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed) VALUES ('My first Category', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 972086460, '', '', '', '', '', '', '', 0, 0);