1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

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' :
$this->load_schema($mode, $sub);
$this->add_modules($mode, $sub);
$this->add_language($mode, $sub);
$this->add_bots($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
*/